Revert "TEMP move stylesheet..." (pushed by mistake)

This reverts commit 7e1a11373b.
This commit is contained in:
Stephan
2015-09-10 11:14:23 +02:00
parent 94b0870a53
commit 8f78ba8b97
7 changed files with 48 additions and 89 deletions

View File

@@ -1,6 +1,5 @@
<%@ Page Language="c#" MasterPageFile="../../masterpages/umbracoPage.Master" CodeBehind="editstylesheet.aspx.cs" AutoEventWireup="True"
Inherits="Umbraco.Web.UI.Umbraco.Settings.Stylesheet.EditStyleSheet" ValidateRequest="False" %>
<%@ Import Namespace="Umbraco.Core" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="cdf" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
@@ -14,12 +13,16 @@
$(document).ready(function () {
var editor = new Umbraco.Editors.EditStyleSheet({
nameTxtBox: $('#<%= NameTxt.ClientID %>'),
originalFileName: '<%= NameTxt.Text %>',
originalFileName: '<%= NameTxt.Text.Replace("\\", "\\\\") %>',
cssId: '<%= Request.QueryString["id"] %>',
saveButton: $("#<%= ((Control)SaveButton).ClientID %>"),
editorSourceElement: $('#<%= editorSource.ClientID %>'),
restServiceLocation: "<%= Url.GetSaveFileServicePath() %>",
treeSyncPath: "<%= TreeSyncPath %>",
lttPathElement: $('#<%= lttPath.ClientID %>')
text: {
cssErrorHeader: '<%= HttpUtility.JavaScriptStringEncode(umbraco.ui.Text("speechBubbles", "cssErrorHeader")) %>',
cssSavedHeader: '<%= HttpUtility.JavaScriptStringEncode(umbraco.ui.Text("speechBubbles", "cssSavedHeader")) %>',
cssSavedText: '<%= HttpUtility.JavaScriptStringEncode(umbraco.ui.Text("speechBubbles", "cssSavedText")) %>',
cssErrorText: 'Please make sure that you have permissions set correctly',
}
});
editor.init();

View File

@@ -61,7 +61,7 @@
});
},
submitSuccess: function (args) {
submitSuccess: function(args) {
var msg = args.message;
var header = args.header;
var path = this._opts.treeSyncPath;

View File

@@ -30,80 +30,37 @@
doSubmit: function() {
var self = this;
var filename = this._opts.nameTxtBox.val();
var codeval = this._opts.editorSourceElement.val();
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();
codeVal = UmbEditor.GetCode();
}
umbraco.presentation.webservices.codeEditorSave.SaveCss(
fileName, self._opts.originalFileName, codeVal, 0,
function (t) { self.submitSucces(t, fileName); },
function(t) { self.submitFailure(t); });
this.save(
filename,
self._opts.originalFileName,
codeval);
},
save: function (filename, oldName, contents) {
var self = this;
$.post(self._opts.restServiceLocation + "SaveStylesheet",
JSON.stringify({
filename: filename,
oldName: oldName,
contents: contents
}),
function (e) {
if (e.success) {
self.submitSuccess(e);
} else {
self.submitFailure(e.message, e.header);
}
});
},
submitSuccess: function (args) {
var msg = args.message;
var header = args.header;
var path = this._opts.treeSyncPath;
var pathChanged = false;
if (args.path) {
if (path != args.path) {
pathChanged = true;
}
path = args.path;
}
if (args.contents) {
UmbEditor.SetCode(args.contents);
}
UmbClientMgr.mainTree().setActiveTreeType("stylesheets");
if (pathChanged) {
// file is used in url so we need to redirect
var qs = window.location.search;
if (qs.startsWith("?")) qs = qs.substring("?".length);
var qp1 = qs.split("&");
var qp2 = [];
for (var i = 0; i < qp1.length; i++)
if (!qp1[i].startsWith("id="))
qp2.push(qp1[i]);
var location = window.location.pathname + "?" + qp2.join("&") + "&id=" + args.name;
UmbClientMgr.contentFrame(location);
// need to do it after we navigate otherwise the navigation waits until the message timeout is done
top.UmbSpeechBubble.ShowMessage("save", header, msg);
submitSucces: function (t, fileName) {
if (t != 'true') {
top.UmbSpeechBubble.ShowMessage('error', unescape(this._opts.text.cssErrorHeader), unescape(this._opts.text.cssErrorText));
}
else {
top.UmbSpeechBubble.ShowMessage("save", header, msg);
this._opts.lttPathElement.prop("href", args.url).html(args.url);
this._opts.originalFileName = args.name;
this._opts.treeSyncPath = args.path;
UmbClientMgr.mainTree().syncTree(path, true);
top.UmbSpeechBubble.ShowMessage('save', unescape(this._opts.text.cssSavedHeader), unescape(this._opts.text.cssSavedText));
}
UmbClientMgr.mainTree().setActiveTreeType('stylesheets');
UmbClientMgr.mainTree().syncTree("-1,init," + fileName, true);
//update the originalFileName prop
this._opts.originalFileName = this._opts.nameTxtBox.val();
},
submitFailure: function(err, header) {
top.UmbSpeechBubble.ShowMessage('error', header, err);
submitFailure: function(t) {
top.UmbSpeechBubble.ShowMessage('error', unescape(this._opts.text.cssErrorHeader), unescape(this._opts.text.cssErrorText));
}
});
})(jQuery);