Patching from 6.1

This commit is contained in:
Shannon Deminick
2013-05-08 17:39:03 -10:00
parent 0762decd92
commit a009dfe2a1
6 changed files with 160 additions and 90 deletions

View File

@@ -695,6 +695,7 @@
<Content Include="umbraco_Client\Editors\DirectoryBrowser.css" />
<Content Include="Umbraco_Client\Dialogs\EditMacro.js" />
<Content Include="Umbraco_Client\Dialogs\UmbracoField.js" />
<Content Include="Umbraco_Client\Editors\EditScript.js" />
<Content Include="Umbraco_Client\Editors\EditMacro.css" />
<Content Include="Umbraco_Client\Editors\EditStyleSheet.js" />
<Content Include="Umbraco_Client\Editors\EditTemplate.js" />

View File

@@ -3,12 +3,16 @@
ValidateRequest="False" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<asp:Content ID="DocTypeContent" ContentPlaceHolderID="DocType" runat="server">
<!DOCTYPE html>
</asp:Content>
<asp:Content ContentPlaceHolderID="head" runat="server">
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="Editors/EditScript.js" PathNameAlias="UmbracoClient" />
<script language="javascript" type="text/javascript">
function doSubmit() {
@@ -30,7 +34,12 @@
}
function submitFailure(t) {
top.UmbSpeechBubble.ShowMessage('error', '<%= umbraco.ui.Text("speechBubbles", "fileErrorHeader") %>', '<%= umbraco.ui.Text("speechBubbles", "fileErrorText") %>')
}
}
jQuery(document).ready(function () {
UmbClientMgr.appActions().bindSaveShortCut();
});
</script>
</asp:Content>
<asp:Content ContentPlaceHolderID="body" runat="server">
@@ -48,9 +57,5 @@
</cc1:PropertyPanel>
</cc1:Pane>
</cc1:UmbracoPanel>
<script type="text/javascript">
jQuery(document).ready(function () {
UmbClientMgr.appActions().bindSaveShortCut();
});
</script>
</asp:Content>

View File

@@ -8,32 +8,27 @@
<cdf:JsInclude runat="server" FilePath="Editors/EditStyleSheet.js" PathNameAlias="UmbracoClient"></cdf:JsInclude>
<script type="text/javascript">
function doSubmit() {
//this is the method that is assigned to the save button from the code behind
var codeVal = jQuery('#<%= editorSource.ClientID %>').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: jQuery('#<%= NameTxt.ClientID %>').val(),
oldName: '<%= NameTxt.Text %>',
cssId: '<%= Request.QueryString["id"] %>',
text: {
cssErrorHeader: '<%= umbraco.ui.Text("speechBubbles", "cssErrorHeader") %>',
cssSavedHeader: '<%= umbraco.ui.Text("speechBubbles", "cssSavedHeader") %>',
cssSavedText: '<%= umbraco.ui.Text("speechBubbles", "cssSavedText") %>',
cssErrorText: 'Please make sure that you have permissions set correctly',
}
});
processor.save();
}
jQuery(document).ready(function () {
UmbClientMgr.appActions().bindSaveShortCut();
});
(function ($) {
$(document).ready(function () {
var editor = new Umbraco.Editors.EditStyleSheet({
nameTxtBox: $('#<%= NameTxt.ClientID %>'),
originalFileName: '<%= NameTxt.Text %>',
cssId: '<%= Request.QueryString["id"] %>',
saveButton: $("#<%= ((Control)SaveButton).ClientID %>"),
editorSourceElement: $('#<%= editorSource.ClientID %>'),
text: {
cssErrorHeader: '<%= umbraco.ui.Text("speechBubbles", "cssErrorHeader") %>',
cssSavedHeader: '<%= umbraco.ui.Text("speechBubbles", "cssSavedHeader") %>',
cssSavedText: '<%= umbraco.ui.Text("speechBubbles", "cssSavedText") %>',
cssErrorText: 'Please make sure that you have permissions set correctly',
}
});
editor.init();
});
})(jQuery);
</script>
</asp:Content>

View File

@@ -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) {
//<summary>Static method to do the saving</summary>
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);

View File

@@ -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) {
//<summary>Static method to do the saving</summary>
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);

View File

@@ -17,20 +17,25 @@ 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"] + "')";
save.AltText = "Save stylesheet";
save.ID = "save";
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)
{
Panel1.Text = ui.Text("stylesheet", "editstylesheet", getUser());
pp_name.Text = ui.Text("name", getUser());
pp_path.Text = ui.Text("path", getUser());