Patching from 6.1

This commit is contained in:
Shannon Deminick
2013-05-08 17:24:00 -10:00
parent a626efa9b6
commit 15bff44ec1
10 changed files with 231 additions and 318 deletions

View File

@@ -370,6 +370,12 @@
<Compile Include="Umbraco\Settings\EditTemplate.aspx.designer.cs">
<DependentUpon>editTemplate.aspx</DependentUpon>
</Compile>
<Compile Include="Umbraco\settings\Stylesheet\editstylesheet.aspx.cs">
<DependentUpon>editstylesheet.aspx</DependentUpon>
</Compile>
<Compile Include="Umbraco\settings\Stylesheet\editstylesheet.aspx.designer.cs">
<DependentUpon>editstylesheet.aspx</DependentUpon>
</Compile>
<Compile Include="Umbraco\Settings\Views\EditView.aspx.cs">
<DependentUpon>EditView.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -683,6 +689,7 @@
<Content Include="Umbraco_Client\Dialogs\EditMacro.js" />
<Content Include="Umbraco_Client\Dialogs\UmbracoField.js" />
<Content Include="Umbraco_Client\Editors\EditMacro.css" />
<Content Include="Umbraco_Client\Editors\EditStyleSheet.js" />
<Content Include="Umbraco_Client\Editors\EditView.js" />
<Content Include="Umbraco_Client\FileUploader\Js\jquery.fileUploader.js" />
<Content Include="Umbraco_Client\FolderBrowser\Css\folderbrowser.css" />

View File

@@ -1,52 +1,55 @@
<%@ Page Language="c#" MasterPageFile="../../masterpages/umbracoPage.Master" Codebehind="editstylesheet.aspx.cs" AutoEventWireup="True"
Inherits="umbraco.cms.presentation.settings.stylesheet.editstylesheet" ValidateRequest="False" %>
<%@ Page Language="c#" MasterPageFile="../../masterpages/umbracoPage.Master" CodeBehind="editstylesheet.aspx.cs" AutoEventWireup="True"
Inherits="Umbraco.Web.UI.Umbraco.Settings.Stylesheet.EditStyleSheet" ValidateRequest="False" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="cdf" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<asp:Content ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
<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") {
if (typeof (CodeMirror) != "undefined") {
codeVal = UmbEditor.GetCode();
}
umbraco.presentation.webservices.codeEditorSave.SaveCss(jQuery('#<%= NameTxt.ClientID %>').val(), '<%= NameTxt.Text %>', codeVal, '<%= Request.QueryString["id"] %>', submitSucces, submitFailure);
}
function submitSucces(t) {
if (t != 'true') {
top.UmbSpeechBubble.ShowMessage('error', '<%= umbraco.ui.Text("speechBubbles", "CssErrorHeader") %>', 'Please make sure that you have permissions set correctly');
}
else {
top.UmbSpeechBubble.ShowMessage('save', '<%= umbraco.ui.Text("speechBubbles", "cssSavedHeader") %>', '<%= umbraco.ui.Text("speechBubbles", "cssSavedText") %>')
}
}
function submitFailure(t) {
top.UmbSpeechBubble.ShowMessage('error', '<%= umbraco.ui.Text("speechBubbles", "CssErrorHeader") %>', '<%= umbraco.ui.Text("speechBubbles", "CssErrorText") %>')
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();
}
</script>
jQuery(document).ready(function () {
UmbClientMgr.appActions().bindSaveShortCut();
});
</script>
</asp:Content>
<asp:Content ContentPlaceHolderID="body" runat="server">
<cc1:UmbracoPanel ID="Panel1" runat="server" CssClass="panel" hasMenu="true">
<cc1:Pane ID="Pane7" CssClass="pane" runat="server">
<cc1:PropertyPanel ID="pp_name" runat="server">
<asp:TextBox ID="NameTxt" Width="350px" runat="server"></asp:TextBox>
</cc1:PropertyPanel>
<cc1:PropertyPanel ID="pp_path" runat="server">
<asp:Literal ID="lttPath" runat="server"></asp:Literal>
</cc1:PropertyPanel>
<cc1:PropertyPanel id="pp_source" runat="server">
<cc1:CodeArea id="editorSource" CodeBase="Css" ClientSaveMethod="doSubmit" OffSetX="37" OffSetY="54" AutoResize="true" runat="server" />
</cc1:PropertyPanel>
</cc1:Pane>
<cc1:Pane ID="Pane7" CssClass="pane" runat="server">
<cc1:PropertyPanel ID="pp_name" runat="server">
<asp:TextBox ID="NameTxt" Width="350px" runat="server"></asp:TextBox>
</cc1:PropertyPanel>
<cc1:PropertyPanel ID="pp_path" runat="server">
<asp:Literal ID="lttPath" runat="server"></asp:Literal>
</cc1:PropertyPanel>
<cc1:PropertyPanel ID="pp_source" runat="server">
<cc1:CodeArea ID="editorSource" CodeBase="Css" OffSetX="37" OffSetY="54" AutoResize="true" runat="server" />
</cc1:PropertyPanel>
</cc1:Pane>
</cc1:UmbracoPanel>
<script type="text/javascript">
jQuery(document).ready(function () {
UmbClientMgr.appActions().bindSaveShortCut();
});
</script>
</asp:Content>
</asp:Content>

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Umbraco.Web.UI.Umbraco.Settings.Stylesheet
{
public partial class EditStyleSheet : global::umbraco.cms.presentation.settings.stylesheet.editstylesheet
{
}
}

View File

@@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Umbraco.Web.UI.Umbraco.Settings.Stylesheet {
public partial class EditStyleSheet {
}
}

View File

@@ -0,0 +1,66 @@
Umbraco.Sys.registerNamespace("Umbraco.Editors");
(function ($) {
Umbraco.Editors.EditStyleSheet = 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);
UmbClientMgr.mainTree().setActiveTreeType('stylesheets');
UmbClientMgr.mainTree().syncTree("-1,init," + this._opts.cssId, true);
}
},
{
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();
}
});
})(jQuery);

View File

@@ -417,6 +417,7 @@
<Compile Include="umbraco.presentation\umbraco\settings\modals\ShowUmbracoTags.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\settings\stylesheet\editstylesheet.aspx.cs" />
<Compile Include="umbraco.presentation\umbraco\templateControls\Image.cs" />
<Compile Include="umbraco.presentation\umbraco\uQuery\IGetProperty.cs" />
<Compile Include="umbraco.presentation\XsltExtensionAttribute.cs" />
@@ -1514,13 +1515,6 @@
<DependentUpon>editScript.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\settings\stylesheet\editstylesheet.aspx.cs">
<DependentUpon>editstylesheet.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\settings\stylesheet\editstylesheet.aspx.designer.cs">
<DependentUpon>editstylesheet.aspx</DependentUpon>
</Compile>
<Compile Include="umbraco.presentation\umbraco\settings\stylesheet\property\EditStyleSheetProperty.aspx.cs">
<DependentUpon>EditStyleSheetProperty.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -2047,9 +2041,6 @@
<Content Include="umbraco.presentation\umbraco\settings\EditMediaType.aspx">
<SubType>ASPXCodeBehind</SubType>
</Content>
<Content Include="umbraco.presentation\umbraco\settings\stylesheet\editstylesheet.aspx">
<SubType>ASPXCodeBehind</SubType>
</Content>
<Content Include="umbraco.presentation\umbraco\settings\stylesheet\property\EditStyleSheetProperty.aspx" />
<Content Include="umbraco.presentation\umbraco\test.aspx" />
<Content Include="umbraco.presentation\umbraco\tree.aspx">

View File

@@ -1,52 +0,0 @@
<%@ Page Language="c#" MasterPageFile="../../masterpages/umbracoPage.Master" Codebehind="editstylesheet.aspx.cs" AutoEventWireup="True"
Inherits="umbraco.cms.presentation.settings.stylesheet.editstylesheet" ValidateRequest="False" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<asp:Content ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
function doSubmit() {
var codeVal = jQuery('#<%= editorSource.ClientID %>').val();
//if CodeMirror is not defined, then the code editor is disabled.
if (typeof(CodeMirror) != "undefined") {
codeVal = UmbEditor.GetCode();
}
umbraco.presentation.webservices.codeEditorSave.SaveCss(jQuery('#<%= NameTxt.ClientID %>').val(), '<%= NameTxt.Text %>', codeVal, '<%= Request.QueryString["id"] %>', submitSucces, submitFailure);
}
function submitSucces(t) {
if (t != 'true') {
top.UmbSpeechBubble.ShowMessage('error', '<%= umbraco.ui.Text("speechBubbles", "CssErrorHeader") %>', 'Please make sure that you have permissions set correctly');
}
else {
top.UmbSpeechBubble.ShowMessage('save', '<%= umbraco.ui.Text("speechBubbles", "cssSavedHeader") %>', '<%= umbraco.ui.Text("speechBubbles", "cssSavedText") %>')
}
}
function submitFailure(t) {
top.UmbSpeechBubble.ShowMessage('error', '<%= umbraco.ui.Text("speechBubbles", "CssErrorHeader") %>', '<%= umbraco.ui.Text("speechBubbles", "CssErrorText") %>')
}
</script>
</asp:Content>
<asp:Content ContentPlaceHolderID="body" runat="server">
<cc1:UmbracoPanel ID="Panel1" runat="server" CssClass="panel" hasMenu="true">
<cc1:Pane ID="Pane7" CssClass="pane" runat="server">
<cc1:PropertyPanel ID="pp_name" runat="server">
<asp:TextBox ID="NameTxt" Width="350px" runat="server"></asp:TextBox>
</cc1:PropertyPanel>
<cc1:PropertyPanel ID="pp_path" runat="server">
<asp:Literal ID="lttPath" runat="server"></asp:Literal>
</cc1:PropertyPanel>
<cc1:PropertyPanel id="pp_source" runat="server">
<cc1:CodeArea id="editorSource" CodeBase="Css" ClientSaveMethod="doSubmit" OffSetX="37" OffSetY="54" AutoResize="true" runat="server" />
</cc1:PropertyPanel>
</cc1:Pane>
</cc1:UmbracoPanel>
<script type="text/javascript">
jQuery(document).ready(function () {
UmbClientMgr.appActions().bindSaveShortCut();
});
</script>
</asp:Content>

View File

@@ -1,10 +1,11 @@
using System;
using System;
using System.Web.UI;
using Umbraco.Core.IO;
using Umbraco.Web;
using umbraco.BasePages;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.web;
using umbraco.cms.presentation.Trees;
using umbraco.IO;
using umbraco.uicontrols;
namespace umbraco.cms.presentation.settings.stylesheet
@@ -23,38 +24,30 @@ namespace umbraco.cms.presentation.settings.stylesheet
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// editor source
if (!UmbracoSettings.ScriptDisableEditor)
{
// TODO: Register the some script editor js file if you can find a good one.
}
ClientTools
ClientTools
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadStylesheets>().Tree.Alias)
.SyncTree("-1,init," + helper.Request("id"), false);
}
.SyncTree("-1,init," + Request.GetItemAsString("id"), false);
MenuIconI save = Panel1.Menu.NewIcon();
var save = Panel1.Menu.NewIcon();
save.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
save.OnClickCommand = "doSubmit()";
save.OnClickCommand = "Umbraco.Editors.EditStyleSheet.save('" + editorSource.ClientID + "', '" + NameTxt.ClientID + "', '" + NameTxt.Text + "', '" + Request.QueryString["id"] + "')";
save.AltText = "Save stylesheet";
save.ID = "save";
Panel1.Text = ui.Text("stylesheet", "editstylesheet", base.getUser());
pp_name.Text = ui.Text("name", base.getUser());
pp_path.Text = ui.Text("path", base.getUser());
Panel1.Text = ui.Text("stylesheet", "editstylesheet", getUser());
pp_name.Text = ui.Text("name", getUser());
pp_path.Text = ui.Text("path", getUser());
stylesheet = new StyleSheet(int.Parse(Request.QueryString["id"]));
string appPath = Request.ApplicationPath;
var appPath = Request.ApplicationPath;
if (appPath == "/")
appPath = "";
lttPath.Text = "<a target='_blank' href='" + appPath + "/css/" + stylesheet.Text + ".css'>" + appPath +
IO.SystemDirectories.Css + "/" + stylesheet.Text + ".css</a>";
SystemDirectories.Css + "/" + stylesheet.Text + ".css</a>";
if (!IsPostBack)
if (IsPostBack == false)
{
NameTxt.Text = stylesheet.Text;
editorSource.Text = stylesheet.Content;
@@ -68,26 +61,77 @@ namespace umbraco.cms.presentation.settings.stylesheet
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/legacyAjaxCalls.asmx"));
}
#region Web Form Designer generated code
protected override void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Panel1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.UmbracoPanel Panel1;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// Pane7 control.
/// </summary>
private void InitializeComponent()
{
}
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane Pane7;
/// <summary>
/// pp_name control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_name;
/// <summary>
/// NameTxt control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox NameTxt;
/// <summary>
/// pp_path control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_path;
/// <summary>
/// lttPath control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal lttPath;
/// <summary>
/// pp_source control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_source;
/// <summary>
/// editorSource control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.CodeArea editorSource;
#endregion
}
}

View File

@@ -1,87 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace umbraco.cms.presentation.settings.stylesheet {
public partial class editstylesheet {
/// <summary>
/// Panel1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.UmbracoPanel Panel1;
/// <summary>
/// Pane7 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane Pane7;
/// <summary>
/// pp_name control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_name;
/// <summary>
/// NameTxt control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox NameTxt;
/// <summary>
/// pp_path control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_path;
/// <summary>
/// lttPath control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal lttPath;
/// <summary>
/// pp_source control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_source;
/// <summary>
/// editorSource control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.CodeArea editorSource;
}
}

View File

@@ -55,7 +55,7 @@ namespace umbraco.uicontrols
{
get
{
return !UmbracoSettings.ScriptDisableEditor; // && HttpContext.Current.Request.Browser.Browser != "IE";
return UmbracoSettings.ScriptDisableEditor == false;
}
}
@@ -86,18 +86,6 @@ namespace umbraco.uicontrols
ClientDependencyLoader.Instance.RegisterDependency(2, "CodeMirror/js/lib/codemirror.css", "UmbracoClient", ClientDependencyType.Css);
ClientDependencyLoader.Instance.RegisterDependency(3, "CodeMirror/css/umbracoCustom.css", "UmbracoClient", ClientDependencyType.Css);
ClientDependencyLoader.Instance.RegisterDependency(4, "CodeArea/styles.css", "UmbracoClient", ClientDependencyType.Css);
//if (AutoSuggest && HttpContext.Current.Request.Browser.Browser != "IE")
//{
// ClientDependencyLoader.Instance.RegisterDependency(3, "CodeMirror/js/lib/util/simple-hint-customized.js", "UmbracoClient", ClientDependencyType.Javascript);
// ClientDependencyLoader.Instance.RegisterDependency(4, "CodeMirror/js/lib/util/" + CodeBase.ToString().ToLower() + "-hint.js", "UmbracoClient", ClientDependencyType.Javascript);
// ClientDependencyLoader.Instance.RegisterDependency(5, "CodeMirror/js/lib/util/" + CodeBase.ToString().ToLower() + "-hints.js", "UmbracoClient", ClientDependencyType.Javascript);
// ClientDependencyLoader.Instance.RegisterDependency(4, "CodeMirror/js/lib/util/simple-hint.css", "UmbracoClient", ClientDependencyType.Css);
//}
}
}
@@ -107,16 +95,14 @@ namespace umbraco.uicontrols
CodeTextBox = new TextBox();
CodeTextBox.ID = "CodeTextBox";
if (!CodeMirrorEnabled)
if (CodeMirrorEnabled == false)
{
CodeTextBox.Attributes.Add("class", "codepress");
CodeTextBox.Attributes.Add("wrap", "off");
}
CodeTextBox.TextMode = TextBoxMode.MultiLine;
//this.CssClass = "codepress";
this.Controls.Add(CodeTextBox);
}
@@ -128,7 +114,7 @@ namespace umbraco.uicontrols
{
get
{
if (!CodeMirrorEnabled)
if (CodeMirrorEnabled == false)
return CodeTextBox.ClientID;
else
return base.ClientID;
@@ -142,7 +128,7 @@ namespace umbraco.uicontrols
var jsEventCode = "";
if (!CodeMirrorEnabled)
if (CodeMirrorEnabled == false)
{
CodeTextBox.RenderControl(writer);
jsEventCode = RenderBasicEditor();
@@ -176,7 +162,7 @@ namespace umbraco.uicontrols
var UmbEditor;
$(document).ready(function () {
//create the editor
UmbEditor = new Umbraco.Controls.CodeEditor.UmbracoEditor(" + (!CodeMirrorEnabled).ToString().ToLower() + @", '" + this.ClientID + @"');
UmbEditor = new Umbraco.Controls.CodeEditor.UmbracoEditor(" + (CodeMirrorEnabled == false).ToString().ToLower() + @", '" + this.ClientID + @"');
var m_textEditor = jQuery('#" + this.ClientID + @"');
//with codemirror adding divs for line numbers, we need to target a different element
@@ -185,12 +171,7 @@ namespace umbraco.uicontrols
jQuery(window).resize(function(){ resizeTextArea(m_textEditor, " + OffSetX.ToString() + "," + OffSetY.ToString() + @"); });
jQuery(document).ready(function(){ resizeTextArea(m_textEditor, " + OffSetX.ToString() + "," + OffSetY.ToString() + @"); });
});";
/*
if (!UmbracoSettings.ScriptDisableEditor && HttpContext.Current.Request.Browser.Browser == "IE")
{
jsEventCode += "jQuery('<p style=\"color:#999\">" + ui.Text("codemirroriewarning").Replace("'", "\\'") + "</p>').insertAfter('#" + this.ClientID + "');";
}*/
}
jsEventCode = string.Format(@"<script type=""text/javascript"">{0}</script>", jsEventCode);
@@ -213,18 +194,7 @@ namespace umbraco.uicontrols
var extraKeys = "";
var editorMimetype = "";
// if (AutoSuggest && HttpContext.Current.Request.Browser.Browser != "IE")
// {
// extraKeys = @",
// extraKeys: {
// ""'@'"": function(cm) { CodeMirror.{lang}Hint(cm, '@'); },
// ""'.'"": function(cm) { CodeMirror.{lang}Hint(cm, '.'); },
// ""Ctrl-Space"": function(cm) { CodeMirror.{lang}Hint(cm, ''); }
// }".Replace("{lang}", CodeBase.ToString().ToLower());
// }
if (!string.IsNullOrEmpty(EditorMimeType))
if (string.IsNullOrEmpty(EditorMimeType) == false)
editorMimetype = @",
mode: """ + EditorMimeType + "\"";
@@ -250,61 +220,6 @@ namespace umbraco.uicontrols
updateLineInfo(codeEditor);
";
/*
string[] parserFiles = new string[] { "tokenizejavascript.js", "parsejavascript.js" };
string[] cssFile = new string[] { "jscolors.css", "umbracoCustom.css" };
switch (CodeBase)
{
case EditorType.JavaScript:
parserFiles = new string[] { "tokenizejavascript.js", "parsejavascript.js" };
cssFile = new string[] { "jscolors.css", "umbracoCustom.css" };
break;
case EditorType.Css:
parserFiles = new string[] { "parsecss.js" };
cssFile = new string[] { "csscolors.css", "umbracoCustom.css" };
break;
case EditorType.Python:
parserFiles = new string[] { "parsepython.js" };
cssFile = new string[] { "pythoncolors.css", "umbracoCustom.css" };
break;
case EditorType.XML:
parserFiles = new string[] { "parsexml.js" };
cssFile = new string[] { "xmlcolors.css", "umbracoCustom.css" };
break;
case EditorType.HTML:
parserFiles = new string[] { "parsexml.js", "parsecss.js", "tokenizejavascript.js", "parsejavascript.js", "parsehtmlmixed.js" };
cssFile = new string[] { "xmlcolors.css", "jscolors.css", "csscolors.css", "umbracoCustom.css" };
break;
}
var jsEventCode = @"
var textarea = document.getElementById('" + CodeTextBox.ClientID + @"');
var codeEditor = CodeMirror.fromTextArea(textarea, {
width: ""100%"",
height: ""100%"",
tabMode: ""shift"",
textWrapping: false,
lineNumbers: true,
parserfile: [" + string.Join(",",
parserFiles
.Select(x => string.Format(@"""{0}""", x))
.ToArray()) + @"],
stylesheet: [" + string.Join(",",
cssFile
.Select(x => string.Format(@"""{0}""", IOHelper.ResolveUrl(SystemDirectories.Umbraco_client) + @"/CodeMirror/css/" + x))
.ToArray()) + @"],
path: """ + IOHelper.ResolveUrl(SystemDirectories.Umbraco_client) + @"/CodeMirror/js/"",
content: textarea.value,
autoMatchParens: false,"
+ (string.IsNullOrEmpty(ClientSaveMethod) ? "" : @"saveFunction: " + ClientSaveMethod + ",") + @"
onChange: function() {}});
";
*/
return jsEventCode;
}
}