Removing unused code and also working on U4-5805
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using umbraco.editorControls.tinyMCE3;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.Attributes
|
||||
{
|
||||
@@ -7,7 +7,7 @@ namespace Umbraco.Tests.CodeFirst.Attributes
|
||||
public class RichtextAttribute : PropertyTypeAttribute
|
||||
{
|
||||
public RichtextAttribute()
|
||||
: base(typeof(tinyMCE3dataType))
|
||||
: base(typeof(RichTextPropertyEditor))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
using Umbraco.Tests.CodeFirst.Attributes;
|
||||
using umbraco.editorControls.textfield;
|
||||
using umbraco.editorControls.tinyMCE3;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Tests.CodeFirst.TestModels
|
||||
{
|
||||
public class ModelWithNewDataType : ContentTypeBase
|
||||
{
|
||||
[PropertyType(typeof(TextFieldDataType), PropertyGroup = "Content")]
|
||||
[PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")]
|
||||
public string Title { get; set; }
|
||||
|
||||
[PropertyType(typeof(tinyMCE3dataType), PropertyGroup = "Content")]
|
||||
[PropertyType(typeof(RichTextPropertyEditor), PropertyGroup = "Content")]
|
||||
public string BodyContent { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,10 @@
|
||||
using System.Xml.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
using umbraco.editorControls.tinyMCE3;
|
||||
using umbraco.interfaces;
|
||||
|
||||
namespace Umbraco.Tests.Models
|
||||
{
|
||||
|
||||
@@ -8,14 +8,11 @@ using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Rdbms;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.Caching;
|
||||
using Umbraco.Core.Persistence.Mappers;
|
||||
using Umbraco.Core.Persistence.Querying;
|
||||
using Umbraco.Core.Persistence.Repositories;
|
||||
using Umbraco.Core.Persistence.UnitOfWork;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
using umbraco.editorControls.tinyMCE3;
|
||||
using umbraco.interfaces;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Tests.Persistence.Repositories
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.EntityBase;
|
||||
using Umbraco.Core.Models.Rdbms;
|
||||
@@ -10,12 +9,9 @@ using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.Caching;
|
||||
using Umbraco.Core.Persistence.Querying;
|
||||
using Umbraco.Core.Persistence.Repositories;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
using Umbraco.Core.Persistence.UnitOfWork;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
using umbraco.editorControls.tinyMCE3;
|
||||
using umbraco.interfaces;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Tests.Persistence.Repositories
|
||||
|
||||
@@ -11,8 +11,6 @@ using Umbraco.Core.Persistence.Repositories;
|
||||
using Umbraco.Core.Persistence.UnitOfWork;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
using umbraco.editorControls.tinyMCE3;
|
||||
using umbraco.interfaces;
|
||||
|
||||
namespace Umbraco.Tests.Persistence.Repositories
|
||||
{
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Events;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Publishing;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
using umbraco.editorControls.tinyMCE3;
|
||||
using umbraco.interfaces;
|
||||
using System.Linq;
|
||||
|
||||
namespace Umbraco.Tests.Publishing
|
||||
|
||||
@@ -6,7 +6,6 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.UnitOfWork;
|
||||
@@ -14,8 +13,6 @@ using Umbraco.Core.Publishing;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
using umbraco.editorControls.tinyMCE3;
|
||||
using umbraco.interfaces;
|
||||
|
||||
namespace Umbraco.Tests.Services
|
||||
{
|
||||
|
||||
@@ -28,18 +28,7 @@ namespace Umbraco.Web.BaseRest
|
||||
: s.ToLower().Split(Split, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
static string GetAttribute(XmlNode node, string name)
|
||||
{
|
||||
if (node == null)
|
||||
throw new ArgumentNullException("node");
|
||||
var attributes = node.Attributes;
|
||||
if (attributes == null)
|
||||
throw new ArgumentException(@"Node has no Attributes collection.", "node");
|
||||
var attribute = attributes[name];
|
||||
return attribute == null ? null : attribute.Value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
private RestExtensionMethodInfo()
|
||||
{
|
||||
|
||||
@@ -922,9 +922,6 @@
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\sort.aspx.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\publish.aspx.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\endPreview.aspx.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
|
||||
@@ -1,240 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.BusinessLogic;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.BasePages;
|
||||
|
||||
namespace umbraco.dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for publish.
|
||||
/// </summary>
|
||||
[Obsolete("This is no longer used whatsoever and will be removed from the codebase")]
|
||||
public partial class publish : UmbracoEnsuredPage
|
||||
{
|
||||
protected Literal total;
|
||||
|
||||
private int _nodeId;
|
||||
private int _nodesPublished = 0;
|
||||
private readonly List<cms.businesslogic.web.Document> _documents = new List<cms.businesslogic.web.Document>();
|
||||
public static string pageName = "";
|
||||
|
||||
public publish()
|
||||
{
|
||||
CurrentApp = DefaultApps.content.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
_nodeId = int.Parse(helper.Request("id"));
|
||||
var d = new cms.businesslogic.web.Document(_nodeId);
|
||||
pageName = d.Text;
|
||||
|
||||
if (d.Level > 1 && d.PathPublished == false)
|
||||
{
|
||||
TheForm.Visible = false;
|
||||
theEnd.Visible = true;
|
||||
feedbackMsg.type = uicontrols.Feedback.feedbacktype.notice;
|
||||
feedbackMsg.Text = ui.Text("publish", "contentPublishedFailedByParent", d.Text, getUser()) + "</p><p><a href='#' onClick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// add control prefix to variable for support with masterpages
|
||||
var prefix = PublishUnpublishedItems.ClientID.Replace(PublishUnpublishedItems.ID, "");
|
||||
masterPagePrefix.Text = prefix;
|
||||
|
||||
// by default we only count the published ones
|
||||
var totalNodesToPublish = cms.businesslogic.web.Document.CountSubs(_nodeId, true);
|
||||
try
|
||||
{
|
||||
Application.Lock();
|
||||
// We add both all nodes and only published nodes to the application variables so we can ajax query depending on checkboxes
|
||||
Application["publishTotalAll" + _nodeId.ToString()] = cms.businesslogic.CMSNode.CountSubs(_nodeId).ToString();
|
||||
Application["publishTotal" + _nodeId.ToString()] = totalNodesToPublish.ToString();
|
||||
Application["publishDone" + _nodeId.ToString()] = "0";
|
||||
}
|
||||
finally
|
||||
{
|
||||
Application.UnLock();
|
||||
}
|
||||
total.Text = totalNodesToPublish.ToString();
|
||||
|
||||
// Put user code to initialize the page here
|
||||
if (!IsPostBack)
|
||||
{
|
||||
// Add caption to checkbox
|
||||
PublishAll.Text = ui.Text("publish", "publishAll", d.Text, getUser());
|
||||
ok.Text = ui.Text("content", "publish", getUser());
|
||||
ok.Attributes.Add("style", "width: 60px");
|
||||
ok.Attributes.Add("onClick", "startPublication();");
|
||||
|
||||
// Add checkbox event, so the publish unpublished childs gets enabled
|
||||
PublishUnpublishedItems.LabelAttributes.Add("disabled", "true");
|
||||
PublishUnpublishedItems.LabelAttributes.Add("id", "publishUnpublishedItemsLabel");
|
||||
PublishUnpublishedItems.InputAttributes.Add("disabled", "true");
|
||||
PublishAll.InputAttributes.Add("onclick", "togglePublishingModes(this)");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (PublishAll.Checked)
|
||||
{
|
||||
_nodesPublished = 0;
|
||||
|
||||
DoPublishSubs(d);
|
||||
|
||||
Application.Lock();
|
||||
Application["publishTotal" + _nodeId.ToString()] = 0;
|
||||
Application.UnLock();
|
||||
|
||||
feedbackMsg.type = uicontrols.Feedback.feedbacktype.success;
|
||||
|
||||
feedbackMsg.Text = ui.Text("publish", "nodePublishAll", d.Text, getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
|
||||
|
||||
ClientTools.ReloadActionNode(true, true);
|
||||
|
||||
Application.Lock();
|
||||
|
||||
Application["publishTotal" + _nodeId.ToString()] = null;
|
||||
Application["publishDone" + _nodeId.ToString()] = null;
|
||||
Application.UnLock();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (d.PublishWithResult(getUser()))
|
||||
{
|
||||
feedbackMsg.type = uicontrols.Feedback.feedbacktype.success;
|
||||
feedbackMsg.Text = ui.Text("publish", "nodePublish", d.Text, getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
|
||||
}
|
||||
else {
|
||||
feedbackMsg.type = uicontrols.Feedback.feedbacktype.notice;
|
||||
feedbackMsg.Text = ui.Text("publish", "contentPublishedFailedByEvent", d.Text, getUser()) + "</p><p><a href='#' onClick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
|
||||
}
|
||||
ClientTools.ReloadActionNode(true, false);
|
||||
}
|
||||
|
||||
TheForm.Visible = false;
|
||||
theEnd.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void DoPublishSubs(cms.businesslogic.web.Document d)
|
||||
{
|
||||
if (d.Published || PublishUnpublishedItems.Checked)
|
||||
{
|
||||
if (d.PublishWithResult(UmbracoUser))
|
||||
{
|
||||
|
||||
|
||||
_nodesPublished++;
|
||||
Application.Lock();
|
||||
Application["publishDone" + _nodeId.ToString()] = _nodesPublished.ToString();
|
||||
Application.UnLock();
|
||||
foreach (var dc in d.Children)
|
||||
{
|
||||
DoPublishSubs(dc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Warn<publish>("Publishing failed due to event cancelling the publishing for document " + d.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPreRender(EventArgs e)
|
||||
{
|
||||
base.OnPreRender(e);
|
||||
|
||||
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/publication.asmx"));
|
||||
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/legacyAjaxCalls.asmx"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// masterPagePrefix 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 masterPagePrefix;
|
||||
|
||||
/// <summary>
|
||||
/// JsInclude1 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::ClientDependency.Core.Controls.JsInclude JsInclude1;
|
||||
|
||||
/// <summary>
|
||||
/// TheForm 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.Panel TheForm;
|
||||
|
||||
/// <summary>
|
||||
/// PublishAll 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.CheckBox PublishAll;
|
||||
|
||||
/// <summary>
|
||||
/// PublishUnpublishedItems 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.CheckBox PublishUnpublishedItems;
|
||||
|
||||
/// <summary>
|
||||
/// ok 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.Button ok;
|
||||
|
||||
/// <summary>
|
||||
/// ProgBar1 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.ProgressBar ProgBar1;
|
||||
|
||||
/// <summary>
|
||||
/// theEnd 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.Panel theEnd;
|
||||
|
||||
/// <summary>
|
||||
/// feedbackMsg control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.Feedback feedbackMsg;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
@@ -24,9 +23,7 @@ namespace umbraco.NodeFactory
|
||||
[XmlType(Namespace = "http://umbraco.org/webservices/")]
|
||||
public class Node : INode
|
||||
{
|
||||
private Hashtable _aliasToNames = new Hashtable();
|
||||
|
||||
private bool _initialized = false;
|
||||
private bool _initialized = false;
|
||||
private Nodes _children = new Nodes();
|
||||
private Node _parent = null;
|
||||
private int _id;
|
||||
|
||||
-1
@@ -25,7 +25,6 @@ namespace umbraco.cms.presentation.settings.stylesheet
|
||||
}
|
||||
|
||||
private businesslogic.web.StylesheetProperty _stylesheetproperty;
|
||||
private DropDownList _ddl = new DropDownList();
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,6 @@ namespace umbraco.uicontrols {
|
||||
// Ensure that a TabPage cannot be instatiated outside
|
||||
// this assembly -> New instances of a tabpage can only be retrieved through the tabview
|
||||
private bool _hasMenu = true;
|
||||
private readonly ScrollingMenu _menu = new ScrollingMenu();
|
||||
protected LiteralControl ErrorHeaderControl = new LiteralControl();
|
||||
private LiteralControl _closeButtonControl = new LiteralControl();
|
||||
private readonly ValidationSummary _vs = new ValidationSummary();
|
||||
|
||||
@@ -1,623 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.BasePages;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.editorControls.tinymce;
|
||||
using umbraco.editorControls.tinyMCE3.webcontrol;
|
||||
using umbraco.editorControls.wysiwyg;
|
||||
using umbraco.interfaces;
|
||||
using Umbraco.Core.IO;
|
||||
using umbraco.presentation;
|
||||
using umbraco.uicontrols;
|
||||
|
||||
namespace umbraco.editorControls.tinyMCE3
|
||||
{
|
||||
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
|
||||
public class TinyMCE : TinyMCEWebControl, IDataEditor, IMenuElement
|
||||
{
|
||||
private readonly string _activateButtons = "";
|
||||
private readonly string _advancedUsers = "";
|
||||
private readonly SortedList _buttons = new SortedList();
|
||||
private readonly IData _data;
|
||||
private readonly string _disableButtons = "help,visualaid,";
|
||||
private readonly string _editorButtons = "";
|
||||
private readonly bool _enableContextMenu;
|
||||
private readonly bool _fullWidth;
|
||||
private readonly int _height;
|
||||
private readonly SortedList _mceButtons = new SortedList();
|
||||
private readonly ArrayList _menuIcons = new ArrayList();
|
||||
private readonly bool _showLabel;
|
||||
private readonly ArrayList _stylesheets = new ArrayList();
|
||||
private readonly int _width;
|
||||
|
||||
private readonly int m_maxImageWidth = 500;
|
||||
private bool _isInitialized;
|
||||
private string _plugins = "";
|
||||
|
||||
public TinyMCE(IData Data, string Configuration)
|
||||
{
|
||||
_data = Data;
|
||||
try
|
||||
{
|
||||
string[] configSettings = Configuration.Split("|".ToCharArray());
|
||||
|
||||
if (configSettings.Length > 0)
|
||||
{
|
||||
_editorButtons = configSettings[0];
|
||||
|
||||
if (configSettings.Length > 1)
|
||||
if (configSettings[1] == "1")
|
||||
_enableContextMenu = true;
|
||||
|
||||
if (configSettings.Length > 2)
|
||||
_advancedUsers = configSettings[2];
|
||||
|
||||
if (configSettings.Length > 3)
|
||||
{
|
||||
if (configSettings[3] == "1")
|
||||
_fullWidth = true;
|
||||
else if (configSettings[4].Split(',').Length > 1)
|
||||
{
|
||||
_width = int.Parse(configSettings[4].Split(',')[0]);
|
||||
_height = int.Parse(configSettings[4].Split(',')[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// default width/height
|
||||
if (_width < 1)
|
||||
_width = 500;
|
||||
if (_height < 1)
|
||||
_height = 400;
|
||||
|
||||
// add stylesheets
|
||||
if (configSettings.Length > 4)
|
||||
{
|
||||
foreach (string s in configSettings[5].Split(",".ToCharArray()))
|
||||
_stylesheets.Add(s);
|
||||
}
|
||||
|
||||
if (configSettings.Length > 6 && configSettings[6] != "")
|
||||
_showLabel = bool.Parse(configSettings[6]);
|
||||
|
||||
if (configSettings.Length > 7 && configSettings[7] != "")
|
||||
m_maxImageWidth = int.Parse(configSettings[7]);
|
||||
|
||||
// sizing
|
||||
if (!_fullWidth)
|
||||
{
|
||||
config.Add("width", _width.ToString());
|
||||
config.Add("height", _height.ToString());
|
||||
}
|
||||
|
||||
if (_enableContextMenu)
|
||||
_plugins += ",contextmenu";
|
||||
|
||||
|
||||
// If the editor is used in umbraco, use umbraco's own toolbar
|
||||
bool onFront = false;
|
||||
if (GlobalSettings.RequestIsInUmbracoApplication(HttpContext.Current))
|
||||
{
|
||||
config.Add("theme_umbraco_toolbar_location", "external");
|
||||
config.Add("skin", "umbraco");
|
||||
config.Add("inlinepopups_skin ", "umbraco");
|
||||
}
|
||||
else
|
||||
{
|
||||
onFront = true;
|
||||
config.Add("theme_umbraco_toolbar_location", "top");
|
||||
}
|
||||
|
||||
// load plugins
|
||||
IDictionaryEnumerator pluginEnum = tinyMCEConfiguration.Plugins.GetEnumerator();
|
||||
while (pluginEnum.MoveNext())
|
||||
{
|
||||
var plugin = (tinyMCEPlugin)pluginEnum.Value;
|
||||
if (plugin.UseOnFrontend || (!onFront && !plugin.UseOnFrontend))
|
||||
_plugins += "," + plugin.Name;
|
||||
}
|
||||
|
||||
// add the umbraco overrides to the end
|
||||
// NB: It is !!REALLY IMPORTANT!! that these plugins are added at the end
|
||||
// as they make runtime modifications to default plugins, so require
|
||||
// those plugins to be loaded first.
|
||||
_plugins += ",umbracopaste,umbracolink,umbracocontextmenu";
|
||||
|
||||
if (_plugins.StartsWith(","))
|
||||
_plugins = _plugins.Substring(1, _plugins.Length - 1);
|
||||
if (_plugins.EndsWith(","))
|
||||
_plugins = _plugins.Substring(0, _plugins.Length - 1);
|
||||
|
||||
config.Add("plugins", _plugins);
|
||||
|
||||
// Check advanced settings
|
||||
if (UmbracoEnsuredPage.CurrentUser != null && ("," + _advancedUsers + ",").IndexOf("," + UmbracoEnsuredPage.CurrentUser.UserType.Id + ",") >
|
||||
-1)
|
||||
config.Add("umbraco_advancedMode", "true");
|
||||
else
|
||||
config.Add("umbraco_advancedMode", "false");
|
||||
|
||||
// Check maximum image width
|
||||
config.Add("umbraco_maximumDefaultImageWidth", m_maxImageWidth.ToString());
|
||||
|
||||
// Styles
|
||||
string cssFiles = String.Empty;
|
||||
string styles = string.Empty;
|
||||
foreach (string styleSheetId in _stylesheets)
|
||||
{
|
||||
if (styleSheetId.Trim() != "")
|
||||
try
|
||||
{
|
||||
var s = StyleSheet.GetStyleSheet(int.Parse(styleSheetId), false, false);
|
||||
|
||||
if (s.nodeObjectType == StyleSheet.ModuleObjectType)
|
||||
{
|
||||
cssFiles += IOHelper.ResolveUrl(SystemDirectories.Css + "/" + s.Text + ".css");
|
||||
|
||||
foreach (StylesheetProperty p in s.Properties)
|
||||
{
|
||||
if (styles != string.Empty)
|
||||
{
|
||||
styles += ";";
|
||||
}
|
||||
if (p.Alias.StartsWith("."))
|
||||
styles += p.Text + "=" + p.Alias;
|
||||
else
|
||||
styles += p.Text + "=" + p.Alias;
|
||||
}
|
||||
|
||||
cssFiles += ",";
|
||||
}
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
LogHelper.Error<TinyMCE>("Error adding stylesheet to tinymce Id:" + styleSheetId, ee);
|
||||
}
|
||||
}
|
||||
// remove any ending comma (,)
|
||||
if (!string.IsNullOrEmpty(cssFiles))
|
||||
{
|
||||
cssFiles = cssFiles.TrimEnd(',');
|
||||
}
|
||||
|
||||
// language
|
||||
string userLang = (UmbracoEnsuredPage.CurrentUser != null) ?
|
||||
(User.GetCurrent().Language.Contains("-") ?
|
||||
User.GetCurrent().Language.Substring(0, User.GetCurrent().Language.IndexOf("-")) : User.GetCurrent().Language)
|
||||
: "en";
|
||||
config.Add("language", userLang);
|
||||
|
||||
config.Add("content_css", cssFiles);
|
||||
config.Add("theme_umbraco_styles", styles);
|
||||
|
||||
// Add buttons
|
||||
IDictionaryEnumerator ide = tinyMCEConfiguration.Commands.GetEnumerator();
|
||||
while (ide.MoveNext())
|
||||
{
|
||||
var cmd = (tinyMCECommand)ide.Value;
|
||||
if (_editorButtons.IndexOf("," + cmd.Alias + ",") > -1)
|
||||
_activateButtons += cmd.Alias + ",";
|
||||
else
|
||||
_disableButtons += cmd.Alias + ",";
|
||||
}
|
||||
|
||||
if (_activateButtons.Length > 0)
|
||||
_activateButtons = _activateButtons.Substring(0, _activateButtons.Length - 1);
|
||||
if (_disableButtons.Length > 0)
|
||||
_disableButtons = _disableButtons.Substring(0, _disableButtons.Length - 1);
|
||||
|
||||
// Add buttons
|
||||
initButtons();
|
||||
_activateButtons = "";
|
||||
|
||||
int separatorPriority = 0;
|
||||
ide = _mceButtons.GetEnumerator();
|
||||
while (ide.MoveNext())
|
||||
{
|
||||
string mceCommand = ide.Value.ToString();
|
||||
var curPriority = (int)ide.Key;
|
||||
|
||||
// Check priority
|
||||
if (separatorPriority > 0 &&
|
||||
Math.Floor(decimal.Parse(curPriority.ToString()) / 10) >
|
||||
Math.Floor(decimal.Parse(separatorPriority.ToString()) / 10))
|
||||
_activateButtons += "separator,";
|
||||
|
||||
_activateButtons += mceCommand + ",";
|
||||
|
||||
separatorPriority = curPriority;
|
||||
}
|
||||
|
||||
|
||||
config.Add("theme_umbraco_buttons1", _activateButtons);
|
||||
config.Add("theme_umbraco_buttons2", "");
|
||||
config.Add("theme_umbraco_buttons3", "");
|
||||
config.Add("theme_umbraco_toolbar_align", "left");
|
||||
config.Add("theme_umbraco_disable", _disableButtons);
|
||||
|
||||
config.Add("theme_umbraco_path ", "true");
|
||||
config.Add("extended_valid_elements", "div[*]");
|
||||
config.Add("document_base_url", "/");
|
||||
config.Add("relative_urls", "false");
|
||||
config.Add("remove_script_host", "true");
|
||||
config.Add("event_elements", "div");
|
||||
config.Add("paste_auto_cleanup_on_paste", "true");
|
||||
|
||||
config.Add("valid_elements",
|
||||
tinyMCEConfiguration.ValidElements.Substring(1,
|
||||
tinyMCEConfiguration.ValidElements.Length -
|
||||
2));
|
||||
config.Add("invalid_elements", tinyMCEConfiguration.InvalidElements);
|
||||
|
||||
// custom commands
|
||||
if (tinyMCEConfiguration.ConfigOptions.Count > 0)
|
||||
{
|
||||
ide = tinyMCEConfiguration.ConfigOptions.GetEnumerator();
|
||||
while (ide.MoveNext())
|
||||
{
|
||||
config.Add(ide.Key.ToString(), ide.Value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
//if (HttpContext.Current.Request.Path.IndexOf(Umbraco.Core.IO.SystemDirectories.Umbraco) > -1)
|
||||
// config.Add("language", User.GetUser(BasePage.GetUserId(BasePage.umbracoUserContextID)).Language);
|
||||
//else
|
||||
// config.Add("language", System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName);
|
||||
|
||||
if (_fullWidth)
|
||||
{
|
||||
config.Add("auto_resize", "true");
|
||||
base.Columns = 30;
|
||||
base.Rows = 30;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.Columns = 0;
|
||||
base.Rows = 0;
|
||||
}
|
||||
EnableViewState = false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ArgumentException("Incorrect TinyMCE configuration.", "Configuration", ex);
|
||||
}
|
||||
}
|
||||
|
||||
#region TreatAsRichTextEditor
|
||||
|
||||
public virtual bool TreatAsRichTextEditor
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ShowLabel
|
||||
|
||||
public virtual bool ShowLabel
|
||||
{
|
||||
get { return _showLabel; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Editor
|
||||
|
||||
public Control Editor
|
||||
{
|
||||
get { return this; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Save()
|
||||
|
||||
public virtual void Save()
|
||||
{
|
||||
string parsedString = base.Text.Trim();
|
||||
string parsedStringForTinyMce = parsedString;
|
||||
if (parsedString != string.Empty)
|
||||
{
|
||||
parsedString = replaceMacroTags(parsedString).Trim();
|
||||
|
||||
// tidy html - refactored, see #30534
|
||||
if (UmbracoConfig.For.UmbracoSettings().Content.TidyEditorContent)
|
||||
{
|
||||
// always wrap in a <div> - using <p> was a bad idea
|
||||
parsedString = "<div>" + parsedString + "</div>";
|
||||
|
||||
string tidyTxt = library.Tidy(parsedString, false);
|
||||
if (tidyTxt != "[error]")
|
||||
{
|
||||
parsedString = tidyTxt;
|
||||
|
||||
// remove pesky \r\n, and other empty chars
|
||||
parsedString = parsedString.Trim(new char[] { '\r', '\n', '\t', ' ' });
|
||||
|
||||
// compensate for breaking macro tags by tidy (?)
|
||||
parsedString = parsedString.Replace("/?>", "/>");
|
||||
|
||||
// remove the wrapping <div> - safer to check that it is still here
|
||||
if (parsedString.StartsWith("<div>") && parsedString.EndsWith("</div>"))
|
||||
parsedString = parsedString.Substring("<div>".Length, parsedString.Length - "<div></div>".Length);
|
||||
}
|
||||
}
|
||||
|
||||
// rescue umbraco tags
|
||||
parsedString = parsedString.Replace("|||?", "<?").Replace("/|||", "/>").Replace("|*|", "\"");
|
||||
|
||||
// fix images
|
||||
parsedString = tinyMCEImageHelper.cleanImages(parsedString);
|
||||
|
||||
// parse current domain and instances of slash before anchor (to fix anchor bug)
|
||||
// NH 31-08-2007
|
||||
if (HttpContext.Current.Request.ServerVariables != null)
|
||||
{
|
||||
parsedString = parsedString.Replace(helper.GetBaseUrl(HttpContext.Current) + "/#", "#");
|
||||
parsedString = parsedString.Replace(helper.GetBaseUrl(HttpContext.Current), "");
|
||||
}
|
||||
// if a paragraph is empty, remove it
|
||||
if (parsedString.ToLower() == "<p></p>")
|
||||
parsedString = "";
|
||||
|
||||
// save string after all parsing is done, but before CDATA replacement - to put back into TinyMCE
|
||||
parsedStringForTinyMce = parsedString;
|
||||
|
||||
//Allow CDATA nested into RTE without exceptions
|
||||
// GE 2012-01-18
|
||||
parsedString = parsedString.Replace("<![CDATA[", "<!--CDATAOPENTAG-->").Replace("]]>", "<!--CDATACLOSETAG-->");
|
||||
}
|
||||
|
||||
_data.Value = parsedString;
|
||||
|
||||
// update internal webcontrol value with parsed result
|
||||
base.Text = parsedStringForTinyMce;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public virtual string Plugins
|
||||
{
|
||||
get { return _plugins; }
|
||||
set { _plugins = value; }
|
||||
}
|
||||
|
||||
public object[] MenuIcons
|
||||
{
|
||||
get
|
||||
{
|
||||
initButtons();
|
||||
|
||||
var tempIcons = new object[_menuIcons.Count];
|
||||
for (int i = 0; i < _menuIcons.Count; i++)
|
||||
tempIcons[i] = _menuIcons[i];
|
||||
return tempIcons;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region IMenuElement Members
|
||||
|
||||
public string ElementName
|
||||
{
|
||||
get { return "div"; }
|
||||
}
|
||||
|
||||
public string ElementIdPreFix
|
||||
{
|
||||
get { return "umbTinymceMenu"; }
|
||||
}
|
||||
|
||||
public string ElementClass
|
||||
{
|
||||
get { return "tinymceMenuBar"; }
|
||||
}
|
||||
|
||||
public int ExtraMenuWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
initButtons();
|
||||
return _buttons.Count * 40 + 300;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// add current page info
|
||||
base.NodeId = ((cms.businesslogic.datatype.DefaultData)_data).NodeId;
|
||||
if (NodeId != 0)
|
||||
{
|
||||
base.VersionId = ((cms.businesslogic.datatype.DefaultData)_data).Version;
|
||||
config.Add("theme_umbraco_pageId", base.NodeId.ToString());
|
||||
config.Add("theme_umbraco_versionId", base.VersionId.ToString());
|
||||
|
||||
// we'll need to make an extra check for the liveediting as that value is set after the constructor have initialized
|
||||
config.Add("umbraco_toolbar_id",
|
||||
ElementIdPreFix +
|
||||
((cms.businesslogic.datatype.DefaultData)_data).PropertyId);
|
||||
}
|
||||
else
|
||||
{
|
||||
// this is for use when tinymce is used for non default Umbraco pages
|
||||
config.Add("umbraco_toolbar_id",
|
||||
ElementIdPreFix + "_" + this.ClientID);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Empty catch as this is caused by the document doesn't exists yet,
|
||||
// like when using this on an autoform, partly replaced by the if/else check on nodeId above though
|
||||
}
|
||||
base.OnLoad(e);
|
||||
}
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
//Allow CDATA nested into RTE without exceptions
|
||||
// GE 2012-01-18
|
||||
if (_data != null && _data.Value != null)
|
||||
base.Text = _data.Value.ToString().Replace("<!--CDATAOPENTAG-->", "<![CDATA[").Replace("<!--CDATACLOSETAG-->", "]]>");
|
||||
}
|
||||
|
||||
private string replaceMacroTags(string text)
|
||||
{
|
||||
while (findStartTag(text) > -1)
|
||||
{
|
||||
string result = text.Substring(findStartTag(text), findEndTag(text) - findStartTag(text));
|
||||
text = text.Replace(result, generateMacroTag(result));
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
private string generateMacroTag(string macroContent)
|
||||
{
|
||||
string macroAttr = macroContent.Substring(5, macroContent.IndexOf(">") - 5);
|
||||
string macroTag = "|||?UMBRACO_MACRO ";
|
||||
Hashtable attributes = ReturnAttributes(macroAttr);
|
||||
IDictionaryEnumerator ide = attributes.GetEnumerator();
|
||||
while (ide.MoveNext())
|
||||
{
|
||||
if (ide.Key.ToString().IndexOf("umb_") != -1)
|
||||
{
|
||||
// Hack to compensate for Firefox adding all attributes as lowercase
|
||||
string orgKey = ide.Key.ToString();
|
||||
if (orgKey == "umb_macroalias")
|
||||
orgKey = "umb_macroAlias";
|
||||
|
||||
macroTag += orgKey.Substring(4, orgKey.Length - 4) + "=|*|" +
|
||||
ide.Value.ToString().Replace("\\r\\n", Environment.NewLine) + "|*| ";
|
||||
}
|
||||
}
|
||||
macroTag += "/|||";
|
||||
|
||||
return macroTag;
|
||||
}
|
||||
|
||||
[Obsolete("Has been superceded by Umbraco.Core.XmlHelper.GetAttributesFromElement")]
|
||||
public static Hashtable ReturnAttributes(String tag)
|
||||
{
|
||||
var h = new Hashtable();
|
||||
foreach (var i in Umbraco.Core.XmlHelper.GetAttributesFromElement(tag))
|
||||
{
|
||||
h.Add(i.Key, i.Value);
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
private int findStartTag(string text)
|
||||
{
|
||||
string temp = "";
|
||||
text = text.ToLower();
|
||||
if (text.IndexOf("ismacro=\"true\"") > -1)
|
||||
{
|
||||
temp = text.Substring(0, text.IndexOf("ismacro=\"true\""));
|
||||
return temp.LastIndexOf("<");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int findEndTag(string text)
|
||||
{
|
||||
string find = "<!-- endumbmacro -->";
|
||||
|
||||
int endMacroIndex = text.ToLower().IndexOf(find);
|
||||
string tempText = text.ToLower().Substring(endMacroIndex + find.Length,
|
||||
text.Length - endMacroIndex - find.Length);
|
||||
int finalEndPos = 0;
|
||||
while (tempText.Length > 5)
|
||||
if (tempText.Substring(finalEndPos, 6) == "</div>")
|
||||
break;
|
||||
else
|
||||
finalEndPos++;
|
||||
|
||||
return endMacroIndex + find.Length + finalEndPos + 6;
|
||||
}
|
||||
|
||||
private void initButtons()
|
||||
{
|
||||
if (!_isInitialized)
|
||||
{
|
||||
_isInitialized = true;
|
||||
|
||||
// Add icons for the editor control:
|
||||
// Html
|
||||
// Preview
|
||||
// Style picker, showstyles
|
||||
// Bold, italic, Text Gen
|
||||
// Align: left, center, right
|
||||
// Lists: Bullet, Ordered, indent, undo indent
|
||||
// Link, Anchor
|
||||
// Insert: Image, macro, table, formular
|
||||
|
||||
foreach (string button in _activateButtons.Split(','))
|
||||
{
|
||||
if (button.Trim() != "")
|
||||
{
|
||||
try
|
||||
{
|
||||
var cmd = (tinyMCECommand)tinyMCEConfiguration.Commands[button];
|
||||
|
||||
string appendValue = "";
|
||||
if (cmd.Value != "")
|
||||
appendValue = ", '" + cmd.Value + "'";
|
||||
_mceButtons.Add(cmd.Priority, cmd.Command);
|
||||
_buttons.Add(cmd.Priority,
|
||||
new editorButton(cmd.Alias, ui.Text("buttons", cmd.Alias), cmd.Icon,
|
||||
"tinyMCE.execInstanceCommand('" + ClientID + "', '" +
|
||||
cmd.Command + "', " + cmd.UserInterface + appendValue + ")"));
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
LogHelper.Error<TinyMCE>(string.Format("TinyMCE: Error initializing button '{0}'", button), ee);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add save icon
|
||||
int separatorPriority = 0;
|
||||
IDictionaryEnumerator ide = _buttons.GetEnumerator();
|
||||
while (ide.MoveNext())
|
||||
{
|
||||
object buttonObj = ide.Value;
|
||||
var curPriority = (int)ide.Key;
|
||||
|
||||
// Check priority
|
||||
if (separatorPriority > 0 &&
|
||||
Math.Floor(decimal.Parse(curPriority.ToString()) / 10) >
|
||||
Math.Floor(decimal.Parse(separatorPriority.ToString()) / 10))
|
||||
_menuIcons.Add("|");
|
||||
|
||||
try
|
||||
{
|
||||
var e = (editorButton)buttonObj;
|
||||
|
||||
MenuIconI menuItem = new MenuIconClass();
|
||||
|
||||
menuItem.OnClickCommand = e.onClickCommand;
|
||||
menuItem.ImageURL = e.imageUrl;
|
||||
menuItem.AltText = e.alttag;
|
||||
menuItem.ID = e.id;
|
||||
_menuIcons.Add(menuItem);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
separatorPriority = curPriority;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace umbraco.editorControls.tinyMCE3
|
||||
{
|
||||
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
|
||||
public class tinyMCE3dataType : umbraco.cms.businesslogic.datatype.BaseDataType, umbraco.interfaces.IDataType
|
||||
{
|
||||
private umbraco.interfaces.IDataEditor _Editor;
|
||||
private umbraco.interfaces.IData _baseData;
|
||||
private umbraco.interfaces.IDataPrevalue _prevalueeditor;
|
||||
|
||||
public override umbraco.interfaces.IDataEditor DataEditor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Editor == null)
|
||||
_Editor = new TinyMCE(Data, ((umbraco.editorControls.tinymce.tinyMCEPreValueConfigurator)PrevalueEditor).Configuration);
|
||||
return _Editor;
|
||||
}
|
||||
}
|
||||
|
||||
public override umbraco.interfaces.IData Data
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_baseData == null)
|
||||
_baseData = new cms.businesslogic.datatype.DefaultData(this);
|
||||
return _baseData;
|
||||
}
|
||||
}
|
||||
public override Guid Id
|
||||
{
|
||||
get { return new Guid(Constants.PropertyEditors.TinyMCEv3); }
|
||||
}
|
||||
|
||||
public override string DataTypeName
|
||||
{
|
||||
get { return "TinyMCE v3 wysiwyg"; }
|
||||
}
|
||||
|
||||
public override umbraco.interfaces.IDataPrevalue PrevalueEditor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_prevalueeditor == null)
|
||||
_prevalueeditor = new tinymce.tinyMCEPreValueConfigurator(this);
|
||||
return _prevalueeditor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,397 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Text.RegularExpressions;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using ClientDependency.Core.Controls;
|
||||
using ClientDependency.Core;
|
||||
using File = System.IO.File;
|
||||
|
||||
namespace umbraco.editorControls.tinyMCE3.webcontrol
|
||||
{
|
||||
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
|
||||
public class TinyMCEWebControl : TextBox
|
||||
{
|
||||
internal readonly MediaFileSystem _fs;
|
||||
|
||||
public NameValueCollection config = new NameValueCollection();
|
||||
private string temp;
|
||||
|
||||
private int _nodeId = 0;
|
||||
private Guid _versionId;
|
||||
|
||||
public int NodeId
|
||||
{
|
||||
set { _nodeId = value; }
|
||||
get { return _nodeId; }
|
||||
}
|
||||
|
||||
public Guid VersionId
|
||||
{
|
||||
set { _versionId = value; }
|
||||
get { return _versionId; }
|
||||
}
|
||||
|
||||
public string InstallPath
|
||||
{
|
||||
get
|
||||
{
|
||||
if (installPath == null)
|
||||
installPath = this.config["InstallPath"];
|
||||
|
||||
return installPath;
|
||||
}
|
||||
set { installPath = value; }
|
||||
}
|
||||
|
||||
#region private
|
||||
private static readonly object TextChangedEvent = new object();
|
||||
private int rows = 10;
|
||||
private int cols = 70;
|
||||
private bool gzipEnabled, merged;
|
||||
private string installPath, mode;
|
||||
private System.Text.StringBuilder m_scriptInitBlock = new StringBuilder();
|
||||
#endregion
|
||||
|
||||
public TinyMCEWebControl()
|
||||
: base()
|
||||
{
|
||||
_fs = FileSystemProviderManager.Current.GetFileSystemProvider<MediaFileSystem>();
|
||||
|
||||
base.TextMode = TextBoxMode.MultiLine;
|
||||
base.Attributes.Add("style", "visibility: hidden");
|
||||
config.Add("mode", "exact");
|
||||
config.Add("theme", "umbraco");
|
||||
config.Add("umbraco_path", global::Umbraco.Core.IO.IOHelper.ResolveUrl(global::Umbraco.Core.IO.SystemDirectories.Umbraco));
|
||||
CssClass = "tinymceContainer";
|
||||
plugin.ConfigSection configSection = (plugin.ConfigSection)System.Web.HttpContext.Current.GetSection("TinyMCE");
|
||||
|
||||
if (configSection != null)
|
||||
{
|
||||
this.installPath = configSection.InstallPath;
|
||||
this.mode = configSection.Mode;
|
||||
this.gzipEnabled = configSection.GzipEnabled;
|
||||
|
||||
// Copy items into local config collection
|
||||
foreach (string key in configSection.GlobalSettings.Keys)
|
||||
this.config[key] = configSection.GlobalSettings[key];
|
||||
}
|
||||
else
|
||||
{
|
||||
configSection = new plugin.ConfigSection();
|
||||
configSection.GzipExpiresOffset = TimeSpan.FromDays(10).Ticks;
|
||||
this.gzipEnabled = false;
|
||||
this.InstallPath = umbraco.editorControls.tinymce.tinyMCEConfiguration.JavascriptPath;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected override void OnPreRender(EventArgs e)
|
||||
{
|
||||
base.OnPreRender(e);
|
||||
// update macro's and images in text
|
||||
if (_nodeId != 0)
|
||||
{
|
||||
base.Text = ParseMacrosToHtml(FormatMedia(base.Text));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected override void Render(HtmlTextWriter writer)
|
||||
{
|
||||
base.Render(writer);
|
||||
// add a marker to tell Live Editing when a tinyMCE control is on the page
|
||||
writer.Write("<input type='hidden' id='__umbraco_tinyMCE' />");
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs args)
|
||||
{
|
||||
this.config["elements"] = this.ClientID;
|
||||
|
||||
|
||||
bool first = true;
|
||||
|
||||
//TinyMCE uses it's own compressor so leave it up to ScriptManager to render
|
||||
ScriptManager.RegisterClientScriptInclude(this, this.GetType(), _versionId.ToString(), this.ScriptURI);
|
||||
|
||||
// Write script tag start
|
||||
m_scriptInitBlock.Append(HtmlTextWriter.TagLeftChar.ToString());
|
||||
m_scriptInitBlock.Append("script");
|
||||
m_scriptInitBlock.Append(" type=\"text/javascript\"");
|
||||
m_scriptInitBlock.Append(HtmlTextWriter.TagRightChar.ToString());
|
||||
m_scriptInitBlock.Append("\n");
|
||||
|
||||
m_scriptInitBlock.Append("tinyMCE.init({\n");
|
||||
|
||||
// Write options
|
||||
foreach (string key in this.config.Keys)
|
||||
{
|
||||
//TODO: This is a hack to test if we can prevent tinymce from automatically download languages
|
||||
string val = this.config[key];
|
||||
|
||||
if (!first)
|
||||
m_scriptInitBlock.Append(",\n");
|
||||
else
|
||||
first = false;
|
||||
|
||||
// Is boolean state or string
|
||||
if (val == "true" || val == "false")
|
||||
m_scriptInitBlock.Append(key + ":" + this.config[key]);
|
||||
else
|
||||
m_scriptInitBlock.Append(key + ":'" + this.config[key] + "'");
|
||||
}
|
||||
|
||||
m_scriptInitBlock.Append("\n});\n");
|
||||
|
||||
|
||||
// Write script tag end
|
||||
m_scriptInitBlock.Append(HtmlTextWriter.EndTagLeftChars);
|
||||
m_scriptInitBlock.Append("script");
|
||||
m_scriptInitBlock.Append(HtmlTextWriter.TagRightChar.ToString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
string ScriptURI
|
||||
{
|
||||
get
|
||||
{
|
||||
string suffix = "", outURI;
|
||||
|
||||
if (this.InstallPath == null)
|
||||
throw new Exception("Required installPath setting is missing, add it to your web.config. You can also add it directly to your tinymce:TextArea element using InstallPath but the web.config method is recommended since it allows you to switch over to gzip compression.");
|
||||
|
||||
if (this.mode != null)
|
||||
suffix = "_" + this.mode;
|
||||
|
||||
outURI = this.InstallPath + "/tiny_mce_src" + suffix + ".js";
|
||||
if (!File.Exists(global::Umbraco.Core.IO.IOHelper.MapPath(outURI)))
|
||||
throw new Exception("Could not locate TinyMCE by URI:" + outURI + ", Physical path:" + global::Umbraco.Core.IO.IOHelper.MapPath(outURI) + ". Make sure that you configured the installPath to a valid location in your web.config. This path should be an relative or site absolute URI to where TinyMCE is located.");
|
||||
|
||||
// Collect themes, languages and plugins and build gzip URI
|
||||
// TODO: Make sure gzip is re-enabled
|
||||
this.gzipEnabled = true;
|
||||
if (this.gzipEnabled)
|
||||
{
|
||||
ArrayList themes = new ArrayList(), plugins = new ArrayList(), languages = new ArrayList();
|
||||
|
||||
// Add themes
|
||||
if (config["theme"] == null)
|
||||
config["theme"] = "simple";
|
||||
|
||||
foreach (string theme in config["theme"].Split(','))
|
||||
{
|
||||
string themeVal = theme.Trim();
|
||||
|
||||
if (themes.IndexOf(themeVal) == -1)
|
||||
themes.Add(themeVal);
|
||||
}
|
||||
|
||||
// Add plugins
|
||||
if (config["plugins"] != null)
|
||||
{
|
||||
foreach (string plugin in config["plugins"].Split(','))
|
||||
{
|
||||
string pluginVal = plugin.Trim();
|
||||
|
||||
if (plugins.IndexOf(pluginVal) == -1)
|
||||
plugins.Add(pluginVal);
|
||||
}
|
||||
}
|
||||
|
||||
// Add language
|
||||
if (config["language"] == null)
|
||||
config["language"] = "en";
|
||||
|
||||
if (languages.IndexOf(config["language"]) == -1)
|
||||
languages.Add(config["language"]);
|
||||
|
||||
// NH: No clue why these extra dashes are added, but the affect other parts of the implementation
|
||||
// Skip loading of themes and plugins
|
||||
// area.config["theme"] = "-" + area.config["theme"];
|
||||
|
||||
// if (area.config["plugins"] != null)
|
||||
// area.config["plugins"] = "-" + String.Join(",-", area.config["plugins"].Split(','));
|
||||
|
||||
// Build output URI
|
||||
// NH: Use versionId for randomize to ensure we don't download a new tinymce on every single call
|
||||
outURI = umbraco.editorControls.tinymce.tinyMCEConfiguration.PluginPath + "/tinymce3tinymceCompress.aspx?rnd=" + this._versionId.ToString() + "&module=gzipmodule";
|
||||
|
||||
if (themes.Count > 0)
|
||||
outURI += "&themes=" + String.Join(",", ((string[])themes.ToArray(typeof(string))));
|
||||
|
||||
if (plugins.Count > 0)
|
||||
outURI += "&plugins=" + String.Join(",", ((string[])plugins.ToArray(typeof(string))));
|
||||
|
||||
if (languages.Count > 0)
|
||||
outURI += "&languages=" + String.Join(",", ((string[])languages.ToArray(typeof(string))));
|
||||
}
|
||||
|
||||
return outURI;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string FormatMedia(string html)
|
||||
{
|
||||
// root media url
|
||||
var rootMediaUrl = _fs.GetUrl("");
|
||||
|
||||
// Find all media images
|
||||
var pattern = string.Format("<img [^>]*src=\"(?<mediaString>{0}[^\"]*)\" [^>]*>", rootMediaUrl);
|
||||
|
||||
var tags = Regex.Matches(html, pattern, RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
|
||||
|
||||
foreach (Match tag in tags)
|
||||
{
|
||||
if (tag.Groups.Count <= 0)
|
||||
continue;
|
||||
|
||||
// Replace /> to ensure we're in old-school html mode
|
||||
var tempTag = "<img";
|
||||
var orgSrc = tag.Groups["mediaString"].Value;
|
||||
|
||||
// gather all attributes
|
||||
// TODO: This should be replaced with a general helper method - but for now we'll wanna leave umbraco.dll alone for this patch
|
||||
var ht = new Hashtable();
|
||||
var m = Regex.Matches(tag.Value.Replace(">", " >"),
|
||||
"(?<attributeName>\\S*)=\"(?<attributeValue>[^\"]*)\"|(?<attributeName>\\S*)=(?<attributeValue>[^\"|\\s]*)\\s",
|
||||
RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
|
||||
|
||||
//GE: Add ContainsKey check and expand the ifs for readability
|
||||
foreach (Match attributeSet in m)
|
||||
{
|
||||
if (attributeSet.Groups["attributeName"].Value.ToLower() != "src" && ht.ContainsKey(attributeSet.Groups["attributeName"].Value) == false)
|
||||
{
|
||||
ht.Add(attributeSet.Groups["attributeName"].Value, attributeSet.Groups["attributeValue"].Value);
|
||||
}
|
||||
}
|
||||
|
||||
// build the element
|
||||
// Build image tag
|
||||
var ide = ht.GetEnumerator();
|
||||
while (ide.MoveNext())
|
||||
tempTag += string.Format(" {0}=\"{1}\"", ide.Key, ide.Value);
|
||||
|
||||
orgSrc = IOHelper.ResolveUrl(orgSrc.Replace("%20", " "));
|
||||
|
||||
var mediaService = ApplicationContext.Current.Services.MediaService;
|
||||
var imageMedia = mediaService.GetMediaByPath(orgSrc);
|
||||
|
||||
if (imageMedia == null)
|
||||
{
|
||||
tempTag = string.Format("{0} src=\"{1}\" />", tempTag, IOHelper.ResolveUrl(orgSrc));
|
||||
}
|
||||
else
|
||||
{
|
||||
// We're doing .Any checks here instead of FirstOrDefault because the default value of Properties
|
||||
// is not null but default(KeyedCollection<string, Property>). This is a bit easier to read.
|
||||
// To clarify: imageMedia.Properties.FirstOrDefault(x => x.Alias == "umbracoWidth") == null; will NOT work.
|
||||
|
||||
var widthValue = string.Empty;
|
||||
if (imageMedia.Properties.Any(x => x.Alias == "umbracoWidth"))
|
||||
widthValue = imageMedia.Properties.First(x => x.Alias == "umbracoWidth").Value.ToString();
|
||||
|
||||
var heightValue = string.Empty;
|
||||
if (imageMedia.Properties.Any(x => x.Alias == "umbracoHeight"))
|
||||
heightValue = imageMedia.Properties.First(x => x.Alias == "umbracoHeight").Value.ToString();
|
||||
|
||||
// Format the tag
|
||||
if (imageMedia.Properties.Any(x => x.Alias == "umbracoFile"))
|
||||
{
|
||||
var umbracoFileProperty = imageMedia.Properties.First(x => x.Alias == "umbracoFile");
|
||||
tempTag = string.Format("{0} rel=\"{1},{2}\" src=\"{3}\" />", tempTag, widthValue, heightValue, umbracoFileProperty.Value);
|
||||
}
|
||||
}
|
||||
|
||||
html = html.Replace(tag.Value, tempTag);
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
private string ParseMacrosToHtml(string input)
|
||||
{
|
||||
int nodeId = _nodeId;
|
||||
Guid versionId = _versionId;
|
||||
string content = input;
|
||||
|
||||
|
||||
string pattern = @"(<\?UMBRACO_MACRO\W*[^>]*/>)";
|
||||
MatchCollection tags =
|
||||
Regex.Matches(content, pattern, RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
|
||||
|
||||
// Page for macro rendering
|
||||
// page p = new page(nodeId, versionId);
|
||||
|
||||
|
||||
System.Web.HttpContext.Current.Items["macrosAdded"] = 0;
|
||||
System.Web.HttpContext.Current.Items["pageID"] = nodeId.ToString();
|
||||
|
||||
foreach (Match tag in tags)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create div
|
||||
Hashtable attributes = helper.ReturnAttributes(tag.Groups[1].Value);
|
||||
string div = macro.RenderMacroStartTag(attributes, nodeId, versionId); //.Replace(""", "&quot;");
|
||||
|
||||
// Insert macro contents here...
|
||||
macro m;
|
||||
if (helper.FindAttribute(attributes, "macroID") != "")
|
||||
m = macro.GetMacro(int.Parse(helper.FindAttribute(attributes, "macroID")));
|
||||
else
|
||||
{
|
||||
// legacy: Check if the macroAlias is typed in lowercasing
|
||||
string macroAlias = helper.FindAttribute(attributes, "macroAlias");
|
||||
if (macroAlias == "")
|
||||
{
|
||||
macroAlias = helper.FindAttribute(attributes, "macroalias");
|
||||
attributes.Remove("macroalias");
|
||||
attributes.Add("macroAlias", macroAlias);
|
||||
}
|
||||
|
||||
if (macroAlias != "")
|
||||
m = macro.GetMacro(macroAlias);
|
||||
else
|
||||
throw new ArgumentException("umbraco is unable to identify the macro. No id or macroalias was provided for the macro in the macro tag.", tag.Groups[1].Value);
|
||||
}
|
||||
|
||||
if (helper.FindAttribute(attributes, "macroAlias") == "")
|
||||
attributes.Add("macroAlias", m.Alias);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
div += macro.MacroContentByHttp(nodeId, versionId, attributes);
|
||||
}
|
||||
catch
|
||||
{
|
||||
div += "<span style=\"color: green\">No macro content available for WYSIWYG editing</span>";
|
||||
}
|
||||
|
||||
|
||||
div += macro.RenderMacroEndTag();
|
||||
content = content.Replace(tag.Groups[1].Value, div);
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
LogHelper.Error<TinyMCEWebControl>("Macro Parsing Error", ee);
|
||||
string div = "<div class=\"umbMacroHolder mceNonEditable\"><p style=\"color: red\"><strong>umbraco was unable to parse a macro tag, which means that parts of this content might be corrupt.</strong> <br /><br />Best solution is to rollback to a previous version by right clicking the node in the tree and then try to insert the macro again. <br/><br/>Please report this to your system administrator as well - this error has been logged.</p></div>";
|
||||
content = content.Replace(tag.Groups[1].Value, div);
|
||||
}
|
||||
|
||||
}
|
||||
return content;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* $Id: ConfigSection.cs 439 2007-11-26 13:26:10Z spocke $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace umbraco.editorControls.tinyMCE3.webcontrol.plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Description of ConfigSection.
|
||||
/// </summary>
|
||||
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
|
||||
public class ConfigSection
|
||||
{
|
||||
#region private
|
||||
private NameValueCollection globalSettings;
|
||||
private bool gzipEnabled, gzipDiskCache, gzipNoCompression;
|
||||
private string installPath, mode, gzipCachePath;
|
||||
private long gzipExpiresOffset;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public ConfigSection() {
|
||||
this.globalSettings = new NameValueCollection();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string InstallPath {
|
||||
get { return installPath; }
|
||||
set { installPath = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Mode {
|
||||
get { return mode; }
|
||||
set { mode = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public NameValueCollection GlobalSettings {
|
||||
get { return globalSettings; }
|
||||
set { globalSettings = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool GzipEnabled {
|
||||
get { return gzipEnabled; }
|
||||
set { gzipEnabled = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public long GzipExpiresOffset {
|
||||
get { return gzipExpiresOffset; }
|
||||
set { gzipExpiresOffset = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool GzipDiskCache {
|
||||
get { return gzipDiskCache; }
|
||||
set { gzipDiskCache = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string GzipCachePath {
|
||||
get { return gzipCachePath; }
|
||||
set { gzipCachePath = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool GzipNoCompression {
|
||||
get { return gzipNoCompression; }
|
||||
set { gzipNoCompression = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,266 +0,0 @@
|
||||
/*
|
||||
* $Id: GzipCompressor.cs 439 2007-11-26 13:26:10Z spocke $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace umbraco.editorControls.tinyMCE3.webcontrol.plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Description of GzipCompressor.
|
||||
/// </summary>
|
||||
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
|
||||
public class GzipCompressor
|
||||
{
|
||||
#region private
|
||||
private bool diskCache, noCompression;
|
||||
private string cachePath;
|
||||
private ArrayList items;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public GzipCompressor() {
|
||||
this.items = new ArrayList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool NoCompression {
|
||||
get { return noCompression; }
|
||||
set { noCompression = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool DiskCache {
|
||||
get { return diskCache; }
|
||||
set { diskCache = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string CachePath {
|
||||
get { return cachePath; }
|
||||
set { cachePath = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
public void AddFile(string path) {
|
||||
//System.Web.HttpContext.Current.Response.Write(path + "\n");
|
||||
if (File.Exists(path))
|
||||
this.items.Add(new CompressItem(CompressItemType.File, path));
|
||||
else
|
||||
throw new Exception("File could not be found \"" + path + "\", unable to add it for Gzip compression.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
public void AddData(string data) {
|
||||
this.items.Add(new CompressItem(CompressItemType.Chunk, data));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="to_stream"></param>
|
||||
public void Compress(Stream to_stream) {
|
||||
GZipStream gzipStream = null;
|
||||
string key = "";
|
||||
byte[] bytes;
|
||||
|
||||
// Build cache key
|
||||
foreach (CompressItem item in this.items) {
|
||||
if (item.Type == CompressItemType.File)
|
||||
key += item.Data;
|
||||
}
|
||||
|
||||
key = MD5(key);
|
||||
if (this.NoCompression) {
|
||||
this.SendPlainText(key, to_stream);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for cached file on disk, stream that one if it was found
|
||||
if (this.DiskCache && File.Exists(Path.Combine(this.CachePath, key + ".gz"))) {
|
||||
this.StreamFromTo(File.OpenRead(Path.Combine(this.CachePath, key + ".gz")), to_stream, 4096, CloseMode.InStream);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Build new gzipped stream
|
||||
if (this.DiskCache) {
|
||||
gzipStream = new GZipStream(File.OpenWrite(Path.Combine(this.CachePath, key + ".gz")), CompressionMode.Compress);
|
||||
|
||||
// Compress all files into memory
|
||||
foreach (CompressItem item in this.items) {
|
||||
// Add file
|
||||
if (item.Type == CompressItemType.File)
|
||||
StreamFromTo(File.OpenRead(item.Data), gzipStream, 4096, CloseMode.InStream);
|
||||
|
||||
// Add chunk
|
||||
if (item.Type == CompressItemType.Chunk) {
|
||||
bytes = Encoding.ASCII.GetBytes(item.Data.ToCharArray());
|
||||
gzipStream.Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
}
|
||||
|
||||
// Close gzip stream
|
||||
gzipStream.Close();
|
||||
gzipStream = null;
|
||||
|
||||
// Send cached file to user
|
||||
this.StreamFromTo(File.OpenRead(Path.Combine(this.CachePath, key + ".gz")), to_stream, 4096, CloseMode.InStream);
|
||||
} else {
|
||||
gzipStream = new GZipStream(to_stream, CompressionMode.Compress);
|
||||
|
||||
// Compress all files into output stream
|
||||
foreach (CompressItem item in this.items) {
|
||||
// Add file
|
||||
if (item.Type == CompressItemType.File)
|
||||
StreamFromTo(File.OpenRead(item.Data), gzipStream, 4096, CloseMode.InStream);
|
||||
|
||||
// Add chunk
|
||||
if (item.Type == CompressItemType.Chunk) {
|
||||
bytes = Encoding.ASCII.GetBytes(item.Data.ToCharArray());
|
||||
gzipStream.Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (gzipStream != null)
|
||||
gzipStream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
#region private
|
||||
|
||||
private void SendPlainText(string key, Stream to_stream) {
|
||||
Stream fileStream = null;
|
||||
byte[] bytes;
|
||||
|
||||
// Check for cached file on disk, stream that one if it was found
|
||||
if (this.DiskCache && File.Exists(Path.Combine(this.CachePath, key + ".js"))) {
|
||||
this.StreamFromTo(File.OpenRead(Path.Combine(this.CachePath, key + ".js")), to_stream, 4096, CloseMode.InStream);
|
||||
return;
|
||||
}
|
||||
|
||||
// Build new plain text stream
|
||||
if (this.DiskCache) {
|
||||
try {
|
||||
fileStream = File.OpenWrite(Path.Combine(this.CachePath, key + ".js"));
|
||||
|
||||
// Compress all files into memory
|
||||
foreach (CompressItem item in this.items) {
|
||||
// Add file
|
||||
if (item.Type == CompressItemType.File)
|
||||
StreamFromTo(File.OpenRead(item.Data), fileStream, 4096, CloseMode.InStream);
|
||||
|
||||
// Add chunk
|
||||
if (item.Type == CompressItemType.Chunk) {
|
||||
bytes = Encoding.ASCII.GetBytes(item.Data.ToCharArray());
|
||||
fileStream.Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
}
|
||||
|
||||
// Close file stream
|
||||
fileStream.Close();
|
||||
fileStream = null;
|
||||
} finally {
|
||||
// Close file stream
|
||||
if (fileStream != null)
|
||||
fileStream.Close();
|
||||
}
|
||||
|
||||
// Send cached file to user
|
||||
this.StreamFromTo(File.OpenRead(Path.Combine(this.CachePath, key + ".js")), to_stream, 4096, CloseMode.InStream);
|
||||
} else {
|
||||
// Concat all files into output stream
|
||||
foreach (CompressItem item in this.items) {
|
||||
// Add file
|
||||
if (item.Type == CompressItemType.File)
|
||||
StreamFromTo(File.OpenRead(item.Data), to_stream, 4096, CloseMode.InStream);
|
||||
|
||||
// Add chunk
|
||||
if (item.Type == CompressItemType.Chunk) {
|
||||
bytes = Encoding.ASCII.GetBytes(item.Data.ToCharArray());
|
||||
to_stream.Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void StreamFromTo(Stream in_stream, Stream out_stream, int buff_size, CloseMode mode) {
|
||||
byte[] buff = new byte[buff_size];
|
||||
int len;
|
||||
|
||||
try {
|
||||
while ((len = in_stream.Read(buff, 0, buff_size)) > 0) {
|
||||
out_stream.Write(buff, 0, len);
|
||||
out_stream.Flush();
|
||||
}
|
||||
} finally {
|
||||
if (in_stream != null && (mode == CloseMode.Both || mode == CloseMode.InStream))
|
||||
in_stream.Close();
|
||||
|
||||
if (out_stream != null && (mode == CloseMode.Both || mode == CloseMode.OutStream))
|
||||
out_stream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private string MD5(string str) {
|
||||
MD5 md5 = new MD5CryptoServiceProvider();
|
||||
byte[] result = md5.ComputeHash(Encoding.ASCII.GetBytes(str));
|
||||
str = BitConverter.ToString(result);
|
||||
|
||||
return str.Replace("-", "");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
enum CloseMode {
|
||||
None, InStream, OutStream, Both
|
||||
}
|
||||
|
||||
enum CompressItemType {
|
||||
File, Chunk
|
||||
}
|
||||
|
||||
class CompressItem {
|
||||
private string data;
|
||||
private CompressItemType type;
|
||||
|
||||
public CompressItem(CompressItemType type, string data) {
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public string Data {
|
||||
get { return data; }
|
||||
set { data = value; }
|
||||
}
|
||||
|
||||
public CompressItemType Type {
|
||||
get { return type; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
/*
|
||||
* $Id: GzipModule.cs 439 2007-11-26 13:26:10Z spocke $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.IO;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
namespace umbraco.editorControls.tinyMCE3.webcontrol.plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Description of HttpHandler.
|
||||
/// </summary>
|
||||
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
|
||||
public class GzipModule : IModule
|
||||
{
|
||||
/// <summary></summary>
|
||||
/// <param name="context">Request context.</param>
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
HttpRequest request = context.Request;
|
||||
HttpResponse response = context.Response;
|
||||
HttpServerUtility server = context.Server;
|
||||
GzipCompressor gzipCompressor = new GzipCompressor();
|
||||
ConfigSection configSection = (ConfigSection)System.Web.HttpContext.Current.GetSection("TinyMCE");
|
||||
string suffix = "", enc;
|
||||
string[] languages = request.QueryString["languages"].Split(',');
|
||||
bool supportsGzip;
|
||||
|
||||
// Set response headers
|
||||
response.ContentType = "text/javascript";
|
||||
response.Charset = "UTF-8";
|
||||
response.Buffer = false;
|
||||
|
||||
// UMBRACO: Populate the configsection if it's empty
|
||||
if (configSection == null)
|
||||
{
|
||||
configSection = new ConfigSection();
|
||||
configSection.GzipEnabled = true;
|
||||
configSection.InstallPath = umbraco.editorControls.tinymce.tinyMCEConfiguration.JavascriptPath;
|
||||
configSection.GzipExpiresOffset = TimeSpan.FromDays(10).Ticks;
|
||||
}
|
||||
|
||||
// Setup cache
|
||||
response.Cache.SetExpires(DateTime.Now.AddTicks(configSection.GzipExpiresOffset));
|
||||
response.Cache.SetCacheability(HttpCacheability.Public);
|
||||
response.Cache.SetValidUntilExpires(false);
|
||||
|
||||
// Check if it supports gzip
|
||||
enc = Regex.Replace("" + request.Headers["Accept-Encoding"], @"\s+", "").ToLower();
|
||||
supportsGzip = enc.IndexOf("gzip") != -1 || request.Headers["---------------"] != null;
|
||||
enc = enc.IndexOf("x-gzip") != -1 ? "x-gzip" : "gzip";
|
||||
|
||||
// Handle mode/suffix
|
||||
if (configSection.Mode != null)
|
||||
suffix = "_" + configSection.Mode;
|
||||
|
||||
gzipCompressor.AddData("var tinyMCEPreInit = {base : '" + configSection.InstallPath + "', suffix : '" + suffix + "'};");
|
||||
|
||||
// Add core
|
||||
gzipCompressor.AddFile(IOHelper.MapPath(configSection.InstallPath + "/tiny_mce" + suffix + ".js"));
|
||||
|
||||
// Add core languages
|
||||
foreach (string lang in languages)
|
||||
gzipCompressor.AddFile(IOHelper.MapPath(configSection.InstallPath + "/langs/" + lang + ".js"));
|
||||
|
||||
// Add themes
|
||||
if (request.QueryString["themes"] != null)
|
||||
{
|
||||
foreach (string theme in request.QueryString["themes"].Split(','))
|
||||
{
|
||||
gzipCompressor.AddFile(IOHelper.MapPath(configSection.InstallPath + "/themes/" + theme + "/editor_template" + suffix + ".js"));
|
||||
|
||||
// Add theme languages
|
||||
foreach (string lang in languages)
|
||||
{
|
||||
string path = IOHelper.MapPath(configSection.InstallPath + "/themes/" + theme + "/langs/" + lang + ".js");
|
||||
|
||||
if (File.Exists(path))
|
||||
gzipCompressor.AddFile(path);
|
||||
}
|
||||
|
||||
gzipCompressor.AddData("tinymce.ThemeManager.urls['" + theme + "'] = tinymce.baseURL+'/themes/" + theme + "';");
|
||||
}
|
||||
}
|
||||
|
||||
// Add plugins
|
||||
if (request.QueryString["plugins"] != null)
|
||||
{
|
||||
foreach (string plugin in request.QueryString["plugins"].Split(','))
|
||||
{
|
||||
gzipCompressor.AddFile(IOHelper.MapPath(configSection.InstallPath + "/plugins/" + plugin + "/editor_plugin" + suffix + ".js"));
|
||||
|
||||
// Add plugin languages
|
||||
foreach (string lang in languages)
|
||||
{
|
||||
string path = IOHelper.MapPath(configSection.InstallPath + "/plugins/" + plugin + "/langs/" + lang + ".js");
|
||||
|
||||
if (File.Exists(path))
|
||||
gzipCompressor.AddFile(path);
|
||||
}
|
||||
|
||||
gzipCompressor.AddData("tinymce.ThemeManager.urls['" + plugin + "'] = tinymce.baseURL+'/plugins/" + plugin + "';");
|
||||
}
|
||||
}
|
||||
|
||||
// Output compressed file
|
||||
gzipCompressor.NoCompression = !supportsGzip || configSection.GzipNoCompression;
|
||||
if (!gzipCompressor.NoCompression)
|
||||
response.AppendHeader("Content-Encoding", enc);
|
||||
|
||||
gzipCompressor.DiskCache = configSection.GzipDiskCache;
|
||||
gzipCompressor.CachePath = configSection.GzipCachePath;
|
||||
|
||||
gzipCompressor.Compress(response.OutputStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Created by SharpDevelop.
|
||||
* User: spocke
|
||||
* Date: 2007-11-22
|
||||
* Time: 14:32
|
||||
*
|
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Web;
|
||||
|
||||
namespace umbraco.editorControls.tinyMCE3.webcontrol.plugin {
|
||||
/// <summary>
|
||||
/// Description of IAction.
|
||||
/// </summary>
|
||||
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
|
||||
public interface IModule
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
void ProcessRequest(HttpContext context);
|
||||
}
|
||||
}
|
||||
@@ -1,354 +0,0 @@
|
||||
/*
|
||||
* $Id: JSON.cs 439 2007-11-26 13:26:10Z spocke $
|
||||
*
|
||||
* Copyright © 2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace umbraco.editorControls.tinyMCE3.webcontrol.plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Description of JSON.
|
||||
/// </summary>
|
||||
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
|
||||
public class JSON
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static void SerializeRPC(string id, object error, object obj, Stream stream) {
|
||||
JSONWriter writer = new JSONWriter(new StreamWriter(stream));
|
||||
|
||||
// Start JSON output
|
||||
writer.WriteStartObject();
|
||||
writer.WritePropertyName("result");
|
||||
WriteValue(writer, obj);
|
||||
|
||||
// Write id
|
||||
writer.WritePropertyName("id");
|
||||
writer.WriteValue(id);
|
||||
|
||||
// Write error
|
||||
writer.WritePropertyName("error");
|
||||
writer.WriteValue(null);
|
||||
|
||||
// Close
|
||||
writer.WriteEndObject();
|
||||
writer.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="writer"></param>
|
||||
/// <param name="obj"></param>
|
||||
public static void WriteObject(TextWriter writer, object obj) {
|
||||
WriteValue(new JSONWriter(writer), obj);
|
||||
writer.Flush();
|
||||
}
|
||||
|
||||
private static void WriteValue(JSONWriter writer, object obj) {
|
||||
if (obj == null)
|
||||
writer.WriteNull();
|
||||
|
||||
if (obj is System.String)
|
||||
writer.WriteValue((string) obj);
|
||||
|
||||
if (obj is System.Boolean)
|
||||
writer.WriteValue((bool) obj);
|
||||
|
||||
if (obj is System.Double)
|
||||
writer.WriteValue(Convert.ToDouble(obj));
|
||||
|
||||
if (obj is System.Int32)
|
||||
writer.WriteValue(Convert.ToInt32(obj));
|
||||
|
||||
if (obj is System.Int64)
|
||||
writer.WriteValue(Convert.ToInt64(obj));
|
||||
|
||||
if (obj is ArrayList) {
|
||||
writer.WriteStartArray();
|
||||
|
||||
foreach (object val in ((ArrayList) obj))
|
||||
WriteValue(writer, val);
|
||||
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
|
||||
if (obj is string[]) {
|
||||
writer.WriteStartArray();
|
||||
|
||||
foreach (string val in ((string[]) obj))
|
||||
WriteValue(writer, val);
|
||||
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
|
||||
if (obj is NameValueCollection) {
|
||||
writer.WriteStartObject();
|
||||
|
||||
string[] keys = GetReversedKeys(obj);
|
||||
foreach (string key in keys) {
|
||||
writer.WritePropertyName(key);
|
||||
WriteValue(writer, ((NameValueCollection) obj)[key]);
|
||||
}
|
||||
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
|
||||
if (obj is Hashtable) {
|
||||
writer.WriteStartObject();
|
||||
|
||||
string[] keys = GetReversedKeys(obj);
|
||||
foreach (string key in keys) {
|
||||
writer.WritePropertyName((string) key);
|
||||
WriteValue(writer, ((Hashtable) obj)[key]);
|
||||
}
|
||||
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
}
|
||||
|
||||
private static string[] GetReversedKeys(object obj) {
|
||||
ICollection keyCollection;
|
||||
string[] keys;
|
||||
int count;
|
||||
|
||||
if (obj is Hashtable)
|
||||
keyCollection = ((Hashtable) obj).Keys;
|
||||
else
|
||||
keyCollection = ((NameValueCollection) obj).AllKeys;
|
||||
|
||||
count = keyCollection.Count;
|
||||
keys = new string[count];
|
||||
|
||||
foreach (string key in keyCollection)
|
||||
keys[--count] = key;
|
||||
|
||||
Array.Sort(keys);
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
/// <returns></returns>
|
||||
public static object ParseJSON(TextReader reader) {
|
||||
return ReadValue(new JSONReader(reader));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
/// <returns></returns>
|
||||
public static JSONRpcCall ParseRPC(TextReader reader) {
|
||||
JSONRpcCall call = new JSONRpcCall();
|
||||
object obj = ParseJSON(reader);
|
||||
Hashtable jsonRpc = (Hashtable) obj;
|
||||
|
||||
call.Method = (string) jsonRpc["method"];
|
||||
call.Id = (string) jsonRpc["id"];
|
||||
call.Args = (ArrayList) jsonRpc["params"];
|
||||
|
||||
return call;
|
||||
}
|
||||
|
||||
#region private methods
|
||||
|
||||
/* private static void Debug(string str) {
|
||||
System.Web.HttpContext.Current.Trace.Write(str);
|
||||
}*/
|
||||
|
||||
private static object ReadValue(JSONReader reader) {
|
||||
Stack parents = new Stack();
|
||||
object cur = null;
|
||||
string key = null;
|
||||
object obj;
|
||||
|
||||
while (reader.Read()) {
|
||||
//Debug(reader.ToString());
|
||||
|
||||
switch (reader.TokenType) {
|
||||
case JSONToken.Boolean:
|
||||
case JSONToken.Integer:
|
||||
case JSONToken.String:
|
||||
case JSONToken.Float:
|
||||
case JSONToken.Null:
|
||||
if (cur is Hashtable) {
|
||||
//Debug(key + "=" + reader.ToString());
|
||||
((Hashtable) cur)[key] = reader.Value;
|
||||
} else if (cur is ArrayList)
|
||||
((ArrayList) cur).Add(reader.Value);
|
||||
else
|
||||
return reader.Value;
|
||||
|
||||
break;
|
||||
|
||||
case JSONToken.PropertyName:
|
||||
key = (string) reader.Value;
|
||||
break;
|
||||
|
||||
case JSONToken.StartArray:
|
||||
case JSONToken.StartObject:
|
||||
if (reader.TokenType == JSONToken.StartObject)
|
||||
obj = new Hashtable();
|
||||
else
|
||||
obj = new ArrayList();
|
||||
|
||||
if (cur is Hashtable) {
|
||||
//Debug(key + "=" + reader.ToString());
|
||||
((Hashtable) cur)[key] = obj;
|
||||
} else if (cur is ArrayList)
|
||||
((ArrayList) cur).Add(obj);
|
||||
|
||||
parents.Push(cur);
|
||||
cur = obj;
|
||||
|
||||
break;
|
||||
|
||||
case JSONToken.EndArray:
|
||||
case JSONToken.EndObject:
|
||||
obj = parents.Pop();
|
||||
|
||||
if (obj != null)
|
||||
cur = obj;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return cur;
|
||||
}
|
||||
|
||||
private static object ReadValue2(JSONReader jsonReader) {
|
||||
jsonReader.Read();
|
||||
|
||||
switch (jsonReader.TokenType) {
|
||||
case JSONToken.Boolean:
|
||||
return (bool) jsonReader.Value;
|
||||
|
||||
case JSONToken.Integer:
|
||||
return Convert.ToInt32(jsonReader.Value);
|
||||
|
||||
case JSONToken.String:
|
||||
return (string) jsonReader.Value;
|
||||
|
||||
case JSONToken.Float:
|
||||
return (double) jsonReader.Value;
|
||||
|
||||
case JSONToken.Null:
|
||||
return null;
|
||||
|
||||
case JSONToken.StartObject:
|
||||
Hashtable hash = new Hashtable();
|
||||
|
||||
while (jsonReader.TokenType != JSONToken.EndObject) {
|
||||
if (jsonReader.TokenType == JSONToken.PropertyName)
|
||||
hash[jsonReader.Value] = ReadValue(jsonReader);
|
||||
else
|
||||
jsonReader.Read();
|
||||
}
|
||||
|
||||
return hash;
|
||||
|
||||
case JSONToken.StartArray:
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
while (jsonReader.TokenType != JSONToken.EndArray) {
|
||||
if (jsonReader.TokenType == JSONToken.EndArray && jsonReader.Value == null)
|
||||
break;
|
||||
|
||||
list.Add(ReadValue(jsonReader));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static bool FindNext(JSONReader reader, JSONToken token) {
|
||||
if (reader.TokenType == token)
|
||||
return true;
|
||||
|
||||
while (reader.Read() && reader.TokenType != JSONToken.EndObject && reader.TokenType != JSONToken.EndArray) {
|
||||
if (reader.TokenType == token)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool FindNextValue(JSONReader reader) {
|
||||
switch (reader.TokenType) {
|
||||
case JSONToken.Boolean:
|
||||
case JSONToken.Float:
|
||||
case JSONToken.Integer:
|
||||
case JSONToken.Null:
|
||||
case JSONToken.String:
|
||||
return true;
|
||||
}
|
||||
|
||||
while (reader.Read() && reader.TokenType != JSONToken.EndObject) {
|
||||
switch (reader.TokenType) {
|
||||
case JSONToken.Boolean:
|
||||
case JSONToken.Float:
|
||||
case JSONToken.Integer:
|
||||
case JSONToken.Null:
|
||||
case JSONToken.String:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class JSONRpcCall {
|
||||
private string id, method;
|
||||
private ArrayList args;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public JSONRpcCall() {
|
||||
this.args = new ArrayList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Method {
|
||||
get { return method; }
|
||||
set { method = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Id {
|
||||
get { return id; }
|
||||
set { id = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public ArrayList Args {
|
||||
get { return args; }
|
||||
set { args = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,391 +0,0 @@
|
||||
/*
|
||||
* $Id: JSONReader.cs 439 2007-11-26 13:26:10Z spocke $
|
||||
*
|
||||
* Copyright © 2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
|
||||
namespace umbraco.editorControls.tinyMCE3.webcontrol.plugin
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
|
||||
public enum JSONToken
|
||||
{
|
||||
/// <summary> </summary>
|
||||
Boolean,
|
||||
|
||||
/// <summary> </summary>
|
||||
Integer,
|
||||
|
||||
/// <summary> </summary>
|
||||
String,
|
||||
|
||||
/// <summary> </summary>
|
||||
Null,
|
||||
|
||||
/// <summary> </summary>
|
||||
Float,
|
||||
|
||||
/// <summary> </summary>
|
||||
StartArray,
|
||||
|
||||
/// <summary> </summary>
|
||||
EndArray,
|
||||
|
||||
/// <summary> </summary>
|
||||
PropertyName,
|
||||
|
||||
/// <summary> </summary>
|
||||
StartObject,
|
||||
|
||||
/// <summary> </summary>
|
||||
EndObject
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Description of JSONReader.
|
||||
/// </summary>
|
||||
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
|
||||
public class JSONReader
|
||||
{
|
||||
private TextReader reader;
|
||||
private JSONToken token;
|
||||
private object val;
|
||||
private JSONLocation location;
|
||||
private Stack lastLocations;
|
||||
private bool needProp;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
public JSONReader(TextReader reader) {
|
||||
this.reader = reader;
|
||||
this.val = null;
|
||||
this.token = JSONToken.Null;
|
||||
this.location = JSONLocation.Normal;
|
||||
this.lastLocations = new Stack();
|
||||
this.needProp = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public JSONLocation Location {
|
||||
get { return location; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public JSONToken TokenType {
|
||||
get {
|
||||
return this.token;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public object Value {
|
||||
get {
|
||||
return this.val;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool Read() {
|
||||
int chr = this.reader.Read();
|
||||
|
||||
if (chr != -1) {
|
||||
switch ((char) chr) {
|
||||
case '[':
|
||||
this.lastLocations.Push(this.location);
|
||||
this.location = JSONLocation.InArray;
|
||||
this.token = JSONToken.StartArray;
|
||||
this.val = null;
|
||||
this.ReadAway();
|
||||
return true;
|
||||
|
||||
case ']':
|
||||
this.location = (JSONLocation) this.lastLocations.Pop();
|
||||
this.token = JSONToken.EndArray;
|
||||
this.val = null;
|
||||
this.ReadAway();
|
||||
|
||||
if (this.location == JSONLocation.InObject)
|
||||
this.needProp = true;
|
||||
|
||||
return true;
|
||||
|
||||
case '{':
|
||||
this.lastLocations.Push(this.location);
|
||||
this.location = JSONLocation.InObject;
|
||||
this.needProp = true;
|
||||
this.token = JSONToken.StartObject;
|
||||
this.val = null;
|
||||
this.ReadAway();
|
||||
return true;
|
||||
|
||||
case '}':
|
||||
this.location = (JSONLocation) this.lastLocations.Pop();
|
||||
this.token = JSONToken.EndObject;
|
||||
this.val = null;
|
||||
this.ReadAway();
|
||||
|
||||
if (this.location == JSONLocation.InObject)
|
||||
this.needProp = true;
|
||||
|
||||
return true;
|
||||
|
||||
// String
|
||||
case '"':
|
||||
case '\'':
|
||||
return this.ReadString((char) chr);
|
||||
|
||||
// Null
|
||||
case 'n':
|
||||
return this.ReadNull();
|
||||
|
||||
// Bool
|
||||
case 't':
|
||||
case 'f':
|
||||
return this.ReadBool((char) chr);
|
||||
|
||||
default:
|
||||
// Is number
|
||||
if (Char.IsNumber((char) chr) || (char) chr == '-' || (char) chr == '.')
|
||||
return this.ReadNumber((char) chr);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString() {
|
||||
switch (this.token) {
|
||||
case JSONToken.Boolean:
|
||||
return "[Boolean] = " + ((bool) this.Value ? "true" : "false");
|
||||
|
||||
case JSONToken.EndArray:
|
||||
return "[EndArray]";
|
||||
|
||||
case JSONToken.EndObject:
|
||||
return "[EndObject]";
|
||||
|
||||
case JSONToken.Float:
|
||||
return "[Float] = " + Convert.ToDouble(this.Value);
|
||||
|
||||
case JSONToken.Integer:
|
||||
return "[Integer] = " + ((int) this.Value);
|
||||
|
||||
case JSONToken.Null:
|
||||
return "[Null]";
|
||||
|
||||
case JSONToken.StartArray:
|
||||
return "[StartArray]";
|
||||
|
||||
case JSONToken.StartObject:
|
||||
return "[StartObject]";
|
||||
|
||||
case JSONToken.String:
|
||||
return "[String]" + (string) this.Value;
|
||||
|
||||
case JSONToken.PropertyName:
|
||||
return "[PropertyName]" + (string) this.Value;
|
||||
}
|
||||
|
||||
return base.ToString();
|
||||
}
|
||||
|
||||
#region private methods
|
||||
|
||||
private bool ReadString(char quote) {
|
||||
StringBuilder buff = new StringBuilder();
|
||||
this.token = JSONToken.String;
|
||||
bool endString = false;
|
||||
int chr;
|
||||
|
||||
while ((chr = this.reader.Peek()) != -1) {
|
||||
switch (chr) {
|
||||
case '\\':
|
||||
// Read away slash
|
||||
chr = this.reader.Read();
|
||||
|
||||
// Read escape code
|
||||
chr = this.reader.Read();
|
||||
switch (chr) {
|
||||
case 't':
|
||||
buff.Append('\t');
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
buff.Append('\b');
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
buff.Append('\f');
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
buff.Append('\r');
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
buff.Append('\n');
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
buff.Append((char) Convert.ToInt32(ReadLen(4), 16));
|
||||
break;
|
||||
|
||||
default:
|
||||
buff.Append((char) chr);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
case '"':
|
||||
if (chr == quote)
|
||||
endString = true;
|
||||
|
||||
chr = this.reader.Read();
|
||||
if (chr != -1 && chr != quote)
|
||||
buff.Append((char) chr);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
buff.Append((char) this.reader.Read());
|
||||
break;
|
||||
}
|
||||
|
||||
// String terminated
|
||||
if (endString)
|
||||
break;
|
||||
}
|
||||
|
||||
this.ReadAway();
|
||||
|
||||
this.val = buff.ToString();
|
||||
|
||||
// Needed a property
|
||||
if (this.needProp) {
|
||||
this.token = JSONToken.PropertyName;
|
||||
this.needProp = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.location == JSONLocation.InObject && !this.needProp)
|
||||
this.needProp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool ReadNull() {
|
||||
this.token = JSONToken.Null;
|
||||
this.val = null;
|
||||
|
||||
this.ReadAway(3); // ull
|
||||
this.ReadAway();
|
||||
|
||||
if (this.location == JSONLocation.InObject && !this.needProp)
|
||||
this.needProp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool ReadNumber(char start) {
|
||||
StringBuilder buff = new StringBuilder();
|
||||
int chr;
|
||||
bool isFloat = false;
|
||||
|
||||
this.token = JSONToken.Integer;
|
||||
buff.Append(start);
|
||||
|
||||
while ((chr = this.reader.Peek()) != -1) {
|
||||
if (Char.IsNumber((char) chr) || (char) chr == '-' || (char) chr == '.') {
|
||||
if (((char) chr) == '.')
|
||||
isFloat = true;
|
||||
|
||||
buff.Append((char) this.reader.Read());
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
this.ReadAway();
|
||||
|
||||
if (isFloat) {
|
||||
this.token = JSONToken.Float;
|
||||
this.val = Convert.ToDouble(buff.ToString().Replace('.', ','));
|
||||
} else
|
||||
this.val = Convert.ToInt32(buff.ToString());
|
||||
|
||||
if (this.location == JSONLocation.InObject && !this.needProp)
|
||||
this.needProp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool ReadBool(char chr) {
|
||||
this.token = JSONToken.Boolean;
|
||||
this.val = chr == 't';
|
||||
|
||||
if (chr == 't')
|
||||
this.ReadAway(3); // rue
|
||||
else
|
||||
this.ReadAway(4); // alse
|
||||
|
||||
this.ReadAway();
|
||||
|
||||
if (this.location == JSONLocation.InObject && !this.needProp)
|
||||
this.needProp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void ReadAway() {
|
||||
int chr;
|
||||
|
||||
while ((chr = this.reader.Peek()) != -1) {
|
||||
if (chr != ':' && chr != ',' && !Char.IsWhiteSpace((char) chr))
|
||||
break;
|
||||
|
||||
this.reader.Read();
|
||||
}
|
||||
}
|
||||
|
||||
private string ReadLen(int num) {
|
||||
StringBuilder buff = new StringBuilder();
|
||||
int chr;
|
||||
|
||||
for (int i=0; i<num && (chr = this.reader.Read()) != -1; i++)
|
||||
buff.Append((char) chr);
|
||||
|
||||
return buff.ToString();
|
||||
}
|
||||
|
||||
private void ReadAway(int num) {
|
||||
for (int i=0; i<num && this.reader.Read() != -1; i++) ;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,230 +0,0 @@
|
||||
/*
|
||||
* $Id: JSONWriter.cs 439 2007-11-26 13:26:10Z spocke $
|
||||
*
|
||||
* Copyright © 2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
|
||||
namespace umbraco.editorControls.tinyMCE3.webcontrol.plugin
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
|
||||
public enum JSONLocation
|
||||
{
|
||||
/// <summary> </summary>
|
||||
InArray,
|
||||
|
||||
/// <summary> </summary>
|
||||
InObject,
|
||||
|
||||
/// <summary> </summary>
|
||||
Normal
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Description of JSONWriter.
|
||||
/// </summary>
|
||||
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
|
||||
public class JSONWriter
|
||||
{
|
||||
private TextWriter writer;
|
||||
private JSONLocation location;
|
||||
private Stack lastLocations;
|
||||
private int index, lastIndex;
|
||||
private bool isProp = false;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="writer"></param>
|
||||
public JSONWriter(TextWriter writer) {
|
||||
this.writer = writer;
|
||||
this.location = JSONLocation.Normal;
|
||||
this.lastLocations = new Stack();
|
||||
this.index = 0;
|
||||
this.lastIndex = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void WriteStartObject() {
|
||||
this.WriteDelim();
|
||||
this.writer.Write('{');
|
||||
this.lastLocations.Push(this.location);
|
||||
this.lastIndex = this.index;
|
||||
this.location = JSONLocation.InObject;
|
||||
this.index = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void WriteEndObject() {
|
||||
this.writer.Write('}');
|
||||
this.location = (JSONLocation) lastLocations.Pop();
|
||||
this.index = this.lastIndex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void WriteStartArray() {
|
||||
this.WriteDelim();
|
||||
this.writer.Write('[');
|
||||
this.lastLocations.Push(this.location);
|
||||
this.lastIndex = this.index;
|
||||
this.location = JSONLocation.InArray;
|
||||
this.index = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void WriteEndArray() {
|
||||
this.writer.Write(']');
|
||||
this.location = (JSONLocation) lastLocations.Pop();
|
||||
this.index = this.lastIndex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public void WritePropertyName(string name) {
|
||||
this.WriteDelim();
|
||||
this.isProp = true;
|
||||
this.WriteObject(EncodeString(name));
|
||||
this.writer.Write(':');
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="obj"></param>
|
||||
public void WriteProperty(string name, object obj) {
|
||||
this.WritePropertyName(name);
|
||||
this.WriteObject(obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
public void WriteValue(object obj) {
|
||||
this.WriteDelim();
|
||||
this.WriteObject(obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void WriteNull() {
|
||||
this.WriteDelim();
|
||||
this.writer.Write("null");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Close() {
|
||||
this.writer.Close();
|
||||
}
|
||||
|
||||
#region private methods
|
||||
|
||||
private void WriteObject(object obj) {
|
||||
if (obj == null) {
|
||||
this.writer.Write("null");
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj is bool) {
|
||||
this.writer.Write(((bool) obj) == true ? "true" : "false");
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj is int) {
|
||||
this.writer.Write(((int) obj));
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj is long) {
|
||||
this.writer.Write(((long) obj));
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj is float || obj is double) {
|
||||
string str = Convert.ToString(obj);
|
||||
this.writer.Write(str.Replace(',', '.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj is string) {
|
||||
this.writer.Write('"');
|
||||
this.writer.Write(EncodeString((string) obj));
|
||||
this.writer.Write('"');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteDelim() {
|
||||
if (this.index > 0 && !this.isProp)
|
||||
this.writer.Write(',');
|
||||
|
||||
this.isProp = false;
|
||||
this.index++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string EncodeString(string str) {
|
||||
if (str == null)
|
||||
return null;
|
||||
|
||||
StringBuilder strBuilder = new StringBuilder(str.Length);
|
||||
char[] chars = str.ToCharArray();
|
||||
|
||||
for (int i=0; i<chars.Length; i++) {
|
||||
// Unicode it if needed
|
||||
if (chars[i] > 128 || Char.IsControl(chars[i])) {
|
||||
strBuilder.Append("\\u");
|
||||
strBuilder.Append(((int) chars[i]).ToString("X4"));
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (chars[i]) {
|
||||
case '\'':
|
||||
strBuilder.Append("\\\'");
|
||||
break;
|
||||
|
||||
case '\"':
|
||||
strBuilder.Append("\\\"");
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
strBuilder.Append("\\\\");
|
||||
break;
|
||||
|
||||
default:
|
||||
strBuilder.Append(chars[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return strBuilder.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,291 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Xml;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
namespace umbraco.editorControls.tinymce
|
||||
{
|
||||
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
|
||||
public class tinyMCEConfiguration
|
||||
{
|
||||
private static bool _init = false;
|
||||
|
||||
private static Hashtable _commands = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
|
||||
|
||||
private static string _validElements;
|
||||
|
||||
private static Hashtable _configOptions = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
|
||||
|
||||
public static Hashtable ConfigOptions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_init)
|
||||
init();
|
||||
return _configOptions;
|
||||
}
|
||||
set
|
||||
{
|
||||
_configOptions = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static string ValidElements
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_init)
|
||||
init();
|
||||
return _validElements;
|
||||
}
|
||||
set { _validElements = value; }
|
||||
}
|
||||
|
||||
public static string PluginPath = IOHelper.ResolveUrl( SystemDirectories.Umbraco ) + "/plugins/tinymce3";
|
||||
public static string JavascriptPath = IOHelper.ResolveUrl( SystemDirectories.UmbracoClient ) + "/tinymce3";
|
||||
|
||||
private static string _invalidElements;
|
||||
|
||||
public static string InvalidElements
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_init)
|
||||
init();
|
||||
return _invalidElements;
|
||||
}
|
||||
set { _invalidElements = value; }
|
||||
}
|
||||
|
||||
private static Hashtable _plugins = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
|
||||
|
||||
public static Hashtable Plugins
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_init)
|
||||
init();
|
||||
return _plugins;
|
||||
}
|
||||
set { _plugins = value; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Hashtable Commands
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_init)
|
||||
init();
|
||||
return _commands;
|
||||
}
|
||||
}
|
||||
|
||||
public static SortedList SortedCommands
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_init)
|
||||
init();
|
||||
|
||||
SortedList sc = new SortedList();
|
||||
IDictionaryEnumerator ide = _commands.GetEnumerator();
|
||||
while (ide.MoveNext())
|
||||
sc.Add(((tinyMCECommand)ide.Value).Priority, (tinyMCECommand)ide.Value);
|
||||
return sc;
|
||||
}
|
||||
}
|
||||
|
||||
private static void init()
|
||||
{
|
||||
// Load config
|
||||
XmlDocument xd = new XmlDocument();
|
||||
xd.Load(IOHelper.MapPath( SystemFiles.TinyMceConfig ));
|
||||
|
||||
foreach (XmlNode n in xd.DocumentElement.SelectNodes("//command"))
|
||||
{
|
||||
if (!_commands.ContainsKey(n.SelectSingleNode("./umbracoAlias").FirstChild.Value))
|
||||
{
|
||||
bool isStyle = false;
|
||||
if (n.Attributes.GetNamedItem("isStyle") != null)
|
||||
isStyle = bool.Parse(n.Attributes.GetNamedItem("isStyle").Value);
|
||||
|
||||
_commands.Add(
|
||||
n.SelectSingleNode("./umbracoAlias").FirstChild.Value.ToLower(),
|
||||
new tinyMCECommand(
|
||||
isStyle,
|
||||
n.SelectSingleNode("./icon").FirstChild.Value,
|
||||
n.SelectSingleNode("./tinyMceCommand").FirstChild.Value,
|
||||
n.SelectSingleNode("./umbracoAlias").FirstChild.Value.ToLower(),
|
||||
n.SelectSingleNode("./tinyMceCommand").Attributes.GetNamedItem("userInterface").Value,
|
||||
n.SelectSingleNode("./tinyMceCommand").Attributes.GetNamedItem("frontendCommand").Value,
|
||||
n.SelectSingleNode("./tinyMceCommand").Attributes.GetNamedItem("value").Value,
|
||||
int.Parse(n.SelectSingleNode("./priority").FirstChild.Value)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (XmlNode n in xd.DocumentElement.SelectNodes("//plugin"))
|
||||
{
|
||||
if (!_plugins.ContainsKey(n.FirstChild.Value))
|
||||
{
|
||||
bool useOnFrontend = false;
|
||||
if (n.Attributes.GetNamedItem("loadOnFrontend") != null)
|
||||
useOnFrontend = bool.Parse(n.Attributes.GetNamedItem("loadOnFrontend").Value);
|
||||
|
||||
_plugins.Add(
|
||||
n.FirstChild.Value.ToLower(),
|
||||
new tinyMCEPlugin(
|
||||
n.FirstChild.Value,
|
||||
useOnFrontend));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (XmlNode n in xd.DocumentElement.SelectNodes("//config"))
|
||||
{
|
||||
if (!_configOptions.ContainsKey(n.Attributes["key"].FirstChild.Value))
|
||||
{
|
||||
var value = "";
|
||||
if (n.FirstChild != null)
|
||||
value = n.FirstChild.Value;
|
||||
|
||||
_configOptions.Add(
|
||||
n.Attributes["key"].FirstChild.Value.ToLower(),
|
||||
value);
|
||||
}
|
||||
}
|
||||
|
||||
if (xd.DocumentElement.SelectSingleNode("./invalidElements") != null)
|
||||
_invalidElements = xd.DocumentElement.SelectSingleNode("./invalidElements").FirstChild.Value;
|
||||
if (xd.DocumentElement.SelectSingleNode("./validElements") != null)
|
||||
{
|
||||
string _val = xd.DocumentElement.SelectSingleNode("./validElements").FirstChild.Value.Replace("\r", "");
|
||||
foreach (string s in _val.Split("\n".ToCharArray()))
|
||||
_validElements += "'" + s + "' + \n";
|
||||
_validElements = _validElements.Substring(0, _validElements.Length - 4);
|
||||
|
||||
}
|
||||
|
||||
_init = true;
|
||||
}
|
||||
}
|
||||
|
||||
public class tinyMCEPlugin
|
||||
{
|
||||
public tinyMCEPlugin(string Name, bool UseOnFrontEnd)
|
||||
{
|
||||
_name = Name;
|
||||
_useOnFrontend = UseOnFrontEnd;
|
||||
}
|
||||
|
||||
private string _name;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
|
||||
|
||||
private bool _useOnFrontend;
|
||||
|
||||
public bool UseOnFrontend
|
||||
{
|
||||
get { return _useOnFrontend; }
|
||||
set { _useOnFrontend = value; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class tinyMCECommand
|
||||
{
|
||||
|
||||
public tinyMCECommand(bool isStylePicker, string Icon, string Command, string Alias, string UserInterface, string FrontEndCommand, string Value, int Priority)
|
||||
{
|
||||
_isStylePicker = isStylePicker;
|
||||
_icon = Icon;
|
||||
_command = Command;
|
||||
_alias = Alias;
|
||||
_userInterface = UserInterface;
|
||||
_frontEndCommand = FrontEndCommand;
|
||||
_value = Value;
|
||||
_priority = Priority;
|
||||
}
|
||||
|
||||
private bool _isStylePicker;
|
||||
|
||||
public bool IsStylePicker
|
||||
{
|
||||
get { return _isStylePicker; }
|
||||
set { _isStylePicker = value; }
|
||||
}
|
||||
|
||||
|
||||
private string _icon;
|
||||
|
||||
public string Icon
|
||||
{
|
||||
get { return IOHelper.ResolveUrl( SystemDirectories.Umbraco ) + "/" + _icon; }
|
||||
set { _icon = value; }
|
||||
}
|
||||
|
||||
private string _command;
|
||||
|
||||
public string Command
|
||||
{
|
||||
get { return _command; }
|
||||
set { _command = value; }
|
||||
}
|
||||
|
||||
private string _alias;
|
||||
|
||||
public string Alias
|
||||
{
|
||||
get { return _alias; }
|
||||
set { _alias = value; }
|
||||
}
|
||||
|
||||
private string _userInterface;
|
||||
|
||||
public string UserInterface
|
||||
{
|
||||
get { return _userInterface; }
|
||||
set { _userInterface = value; }
|
||||
}
|
||||
|
||||
private string _frontEndCommand;
|
||||
|
||||
public string FrontEndCommand
|
||||
{
|
||||
get { return _frontEndCommand; }
|
||||
set { _frontEndCommand = value; }
|
||||
}
|
||||
|
||||
private string _value;
|
||||
|
||||
public string Value
|
||||
{
|
||||
get { return _value; }
|
||||
set { _value = value; }
|
||||
}
|
||||
|
||||
private int _priority;
|
||||
|
||||
public int Priority
|
||||
{
|
||||
get { return _priority; }
|
||||
set { _priority = value; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,161 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.cms.businesslogic.Files;
|
||||
|
||||
namespace umbraco.editorControls.tinymce
|
||||
{
|
||||
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
|
||||
internal class tinyMCEImageHelper
|
||||
{
|
||||
public static string cleanImages(string html)
|
||||
{
|
||||
var allowedAttributes = UmbracoConfig.For.UmbracoSettings().Content.ImageTagAllowedAttributes.Select(x => x.ToLower()).ToList();
|
||||
|
||||
//Always add src as it's essential to output any image at all
|
||||
if (allowedAttributes.Contains("src") == false)
|
||||
allowedAttributes.Add("src");
|
||||
|
||||
const string pattern = @"<img [^>]*>";
|
||||
var tags = Regex.Matches(html + " ", pattern, RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
|
||||
foreach (Match tag in tags)
|
||||
{
|
||||
if (tag.Value.ToLower().IndexOf("umbraco_macro", StringComparison.Ordinal) == -1)
|
||||
{
|
||||
var cleanTag = "<img";
|
||||
// gather all attributes
|
||||
// TODO: This should be replaced with a general helper method - but for now we'll wanna leave umbraco.dll alone for this patch
|
||||
var ht = new Hashtable();
|
||||
var matches = Regex.Matches(tag.Value.Replace(">", " >"), "(?<attributeName>\\S*?)=\"(?<attributeValue>[^\"]*)\"|(?<attributeName>\\S*?)=(?<attributeValue>[^\"|\\s]*)\\s", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
|
||||
foreach (Match attributeSet in matches)
|
||||
{
|
||||
ht.Add(attributeSet.Groups["attributeName"].Value.ToLower(),
|
||||
attributeSet.Groups["attributeValue"].Value);
|
||||
}
|
||||
|
||||
// If rel attribute exists and if it's different from current sizing we should resize the image!
|
||||
if (helper.FindAttribute(ht, "rel") != "")
|
||||
{
|
||||
// if size has changed resize image serverside
|
||||
var newDims = helper.FindAttribute(ht, "rel").Split(",".ToCharArray());
|
||||
if (newDims.Length > 0 && (newDims[0] != helper.FindAttribute(ht, "width") || newDims[1] != helper.FindAttribute(ht, "height")))
|
||||
{
|
||||
try
|
||||
{
|
||||
int newWidth;
|
||||
int newHeight;
|
||||
string newSrc;
|
||||
|
||||
cleanTag += DoResize(ht, out newWidth, out newHeight, out newSrc);
|
||||
|
||||
ht["src"] = newSrc;
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
cleanTag += " src=\"" + helper.FindAttribute(ht, "src") + "\"";
|
||||
if (helper.FindAttribute(ht, "width") != "")
|
||||
{
|
||||
cleanTag += " width=\"" + helper.FindAttribute(ht, "width") + "\"";
|
||||
cleanTag += " height=\"" + helper.FindAttribute(ht, "height") + "\"";
|
||||
}
|
||||
LogHelper.Error<tinyMCEImageHelper>("Error resizing image in editor", err);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (helper.FindAttribute(ht, "width") != "")
|
||||
{
|
||||
cleanTag += " width=\"" + helper.FindAttribute(ht, "width") + "\"";
|
||||
cleanTag += " height=\"" + helper.FindAttribute(ht, "height") + "\"";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (helper.FindAttribute(ht, "width") != "")
|
||||
{
|
||||
cleanTag += " width=\"" + helper.FindAttribute(ht, "width") + "\"";
|
||||
cleanTag += " height=\"" + helper.FindAttribute(ht, "height") + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
// Build image tag
|
||||
foreach (var attr in allowedAttributes)
|
||||
{
|
||||
if (helper.FindAttribute(ht, attr) != "")
|
||||
{
|
||||
var attrValue = helper.FindAttribute(ht, attr);
|
||||
cleanTag += " " + attr + "=\"" + attrValue + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
if (bool.Parse(GlobalSettings.EditXhtmlMode))
|
||||
cleanTag += "/";
|
||||
|
||||
cleanTag += ">";
|
||||
html = html.Replace(tag.Value, cleanTag);
|
||||
}
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
private static string DoResize(IDictionary attributes, out int finalWidth, out int finalHeight, out string newSrc)
|
||||
{
|
||||
var fs = FileSystemProviderManager.Current.GetFileSystemProvider<MediaFileSystem>();
|
||||
var orgSrc = HttpContext.Current.Server.HtmlDecode(helper.FindAttribute(attributes, "src").Replace("%20", " "));
|
||||
var orgDim = helper.FindAttribute(attributes, "rel").Split(",".ToCharArray());
|
||||
var orgWidth = float.Parse(orgDim[0]);
|
||||
var orgHeight = float.Parse(orgDim[1]);
|
||||
var newWidth = int.Parse(helper.FindAttribute(attributes, "width"));
|
||||
var newHeight = int.Parse(helper.FindAttribute(attributes, "height"));
|
||||
|
||||
newSrc = "";
|
||||
|
||||
if (orgHeight > 0 && orgWidth > 0 && orgSrc != "")
|
||||
{
|
||||
// Check dimensions
|
||||
if (Math.Abs(orgWidth / newWidth) > Math.Abs(orgHeight / newHeight))
|
||||
{
|
||||
newHeight = (int)Math.Round(newWidth * (orgHeight / orgWidth));
|
||||
}
|
||||
else
|
||||
{
|
||||
newWidth = (int)Math.Round(newHeight * (orgWidth / orgHeight));
|
||||
}
|
||||
|
||||
var orgPath = fs.GetRelativePath(orgSrc);
|
||||
if (fs.FileExists(orgPath))
|
||||
{
|
||||
var uf = new UmbracoFile(orgPath);
|
||||
|
||||
try
|
||||
{
|
||||
newSrc = uf.Resize(newWidth, newHeight);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<tinyMCEImageHelper>(string.Format("The file {0} could not be resized, reverting the image src attribute to the original source: {1}", orgPath, orgSrc), ex);
|
||||
newSrc = orgSrc;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Warn<tinyMCEImageHelper>(string.Format("The file {0} does not exist, reverting the image src attribute to the original source: {1}", orgPath, orgSrc));
|
||||
newSrc = orgSrc;
|
||||
}
|
||||
}
|
||||
|
||||
finalWidth = newWidth;
|
||||
finalHeight = newHeight;
|
||||
|
||||
return " width=\"" + newWidth + "\" height=\"" + newHeight + "\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,328 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.DataLayer;
|
||||
|
||||
namespace umbraco.editorControls.tinymce
|
||||
{
|
||||
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
|
||||
public class tinyMCEPreValueConfigurator : System.Web.UI.WebControls.PlaceHolder, interfaces.IDataPrevalue
|
||||
{
|
||||
// UI controls
|
||||
private CheckBoxList _editorButtons;
|
||||
private CheckBox _enableRightClick;
|
||||
private DropDownList _dropdownlist;
|
||||
private CheckBoxList _advancedUsersList;
|
||||
private CheckBoxList _stylesheetList;
|
||||
private TextBox _width = new TextBox();
|
||||
private TextBox _height = new TextBox();
|
||||
private TextBox _maxImageWidth = new TextBox();
|
||||
private CheckBox _fullWidth = new CheckBox();
|
||||
private CheckBox _showLabel = new CheckBox();
|
||||
private RegularExpressionValidator _widthValidator = new RegularExpressionValidator();
|
||||
private RegularExpressionValidator _heightValidator = new RegularExpressionValidator();
|
||||
private RegularExpressionValidator _maxImageWidthValidator = new RegularExpressionValidator();
|
||||
|
||||
// referenced datatype
|
||||
private cms.businesslogic.datatype.BaseDataType _datatype;
|
||||
private string _selectedButtons = "";
|
||||
private string _advancedUsers = "";
|
||||
private string _stylesheets = "";
|
||||
|
||||
public static ISqlHelper SqlHelper
|
||||
{
|
||||
get { return Application.SqlHelper; }
|
||||
}
|
||||
|
||||
public tinyMCEPreValueConfigurator(cms.businesslogic.datatype.BaseDataType DataType)
|
||||
{
|
||||
// state it knows its datatypedefinitionid
|
||||
_datatype = DataType;
|
||||
setupChildControls();
|
||||
}
|
||||
|
||||
private void setupChildControls()
|
||||
{
|
||||
_dropdownlist = new DropDownList();
|
||||
_dropdownlist.ID = "dbtype";
|
||||
_dropdownlist.Items.Add(DBTypes.Date.ToString());
|
||||
_dropdownlist.Items.Add(DBTypes.Integer.ToString());
|
||||
_dropdownlist.Items.Add(DBTypes.Ntext.ToString());
|
||||
_dropdownlist.Items.Add(DBTypes.Nvarchar.ToString());
|
||||
|
||||
_editorButtons = new CheckBoxList();
|
||||
_editorButtons.ID = "editorButtons";
|
||||
_editorButtons.RepeatColumns = 4;
|
||||
_editorButtons.CellPadding = 3;
|
||||
|
||||
_enableRightClick = new CheckBox();
|
||||
_enableRightClick.ID = "enableRightClick";
|
||||
|
||||
_advancedUsersList = new CheckBoxList();
|
||||
_advancedUsersList.ID = "advancedUsersList";
|
||||
|
||||
_stylesheetList = new CheckBoxList();
|
||||
_stylesheetList.ID = "stylesheetList";
|
||||
|
||||
_showLabel = new CheckBox();
|
||||
_showLabel.ID = "showLabel";
|
||||
|
||||
_maxImageWidth = new TextBox();
|
||||
_maxImageWidth.ID = "maxImageWidth";
|
||||
|
||||
// put the childcontrols in context - ensuring that
|
||||
// the viewstate is persisted etc.
|
||||
Controls.Add(_dropdownlist);
|
||||
Controls.Add(_enableRightClick);
|
||||
Controls.Add(_editorButtons);
|
||||
Controls.Add(_advancedUsersList);
|
||||
Controls.Add(_stylesheetList);
|
||||
Controls.Add(_width);
|
||||
Controls.Add(_widthValidator);
|
||||
Controls.Add(_height);
|
||||
Controls.Add(_heightValidator);
|
||||
Controls.Add(_showLabel);
|
||||
Controls.Add(_maxImageWidth);
|
||||
Controls.Add(_maxImageWidthValidator);
|
||||
// Controls.Add(_fullWidth);
|
||||
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad (e);
|
||||
// add ids to controls
|
||||
_width.ID = "width";
|
||||
_height.ID = "height";
|
||||
|
||||
|
||||
// initialize validators
|
||||
_widthValidator.ValidationExpression = "0*[1-9][0-9]*";
|
||||
_widthValidator.ErrorMessage = ui.Text("errorHandling", "errorIntegerWithoutTab", ui.Text("width"), new BasePages.BasePage().getUser());
|
||||
_widthValidator.Display = ValidatorDisplay.Dynamic;
|
||||
_widthValidator.ControlToValidate = _width.ID;
|
||||
_heightValidator.ValidationExpression = "0*[1-9][0-9]*";
|
||||
_heightValidator.ErrorMessage = ui.Text("errorHandling", "errorIntegerWithoutTab", ui.Text("height"), new BasePages.BasePage().getUser());
|
||||
_heightValidator.ControlToValidate = _height.ID;
|
||||
_heightValidator.Display = ValidatorDisplay.Dynamic;
|
||||
_maxImageWidthValidator.ValidationExpression = "0*[1-9][0-9]*";
|
||||
_maxImageWidthValidator.ErrorMessage = ui.Text("errorHandling", "errorIntegerWithoutTab","'" + ui.Text("rteMaximumDefaultImgSize") + "'", new BasePages.BasePage().getUser());
|
||||
_maxImageWidthValidator.ControlToValidate = _maxImageWidth.ID;
|
||||
_maxImageWidthValidator.Display = ValidatorDisplay.Dynamic;
|
||||
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
if (Configuration != null)
|
||||
{
|
||||
string[] config = Configuration.Split("|".ToCharArray());
|
||||
if (config.Length > 0)
|
||||
{
|
||||
_selectedButtons = config[0];
|
||||
|
||||
if (config.Length > 1)
|
||||
if (config[1] == "1")
|
||||
_enableRightClick.Checked = true;
|
||||
|
||||
if (config.Length > 2)
|
||||
_advancedUsers = config[2];
|
||||
|
||||
if (config.Length > 4 && config[4].Split(',').Length > 1)
|
||||
{
|
||||
// if (config[3] == "1")
|
||||
// _fullWidth.Checked = true;
|
||||
// else
|
||||
// {
|
||||
_width.Text = config[4].Split(',')[0];
|
||||
_height.Text = config[4].Split(',')[1];
|
||||
// }
|
||||
}
|
||||
|
||||
// if width and height are empty or lower than 0 then set default sizes:
|
||||
int tempWidth, tempHeight;
|
||||
int.TryParse(_width.Text, out tempWidth);
|
||||
int.TryParse(_height.Text, out tempHeight);
|
||||
if (_width.Text.Trim() == "" || tempWidth < 1)
|
||||
_width.Text = "500";
|
||||
if (_height.Text.Trim() == "" || tempHeight < 1)
|
||||
_height.Text = "400";
|
||||
|
||||
if (config.Length > 5)
|
||||
_stylesheets = config[5];
|
||||
if (config.Length > 6 && config[6] != "")
|
||||
_showLabel.Checked = bool.Parse(config[6]);
|
||||
|
||||
if (config.Length > 7 && config[7] != "")
|
||||
_maxImageWidth.Text = config[7];
|
||||
else
|
||||
_maxImageWidth.Text = "500";
|
||||
}
|
||||
|
||||
// add editor buttons
|
||||
IDictionaryEnumerator ide = tinyMCEConfiguration.SortedCommands.GetEnumerator();
|
||||
while (ide.MoveNext())
|
||||
{
|
||||
tinyMCECommand cmd = (tinyMCECommand) ide.Value;
|
||||
ListItem li =
|
||||
new ListItem(
|
||||
string.Format("<img src=\"{0}\" class=\"tinymceIcon\" alt=\"{1}\" /> ", cmd.Icon,
|
||||
cmd.Alias), cmd.Alias);
|
||||
if (_selectedButtons.IndexOf(cmd.Alias) > -1)
|
||||
li.Selected = true;
|
||||
|
||||
_editorButtons.Items.Add(li);
|
||||
}
|
||||
|
||||
// add users
|
||||
foreach (BusinessLogic.UserType ut in BusinessLogic.UserType.getAll)
|
||||
{
|
||||
ListItem li = new ListItem(ut.Name, ut.Id.ToString());
|
||||
if (("," + _advancedUsers + ",").IndexOf("," + ut.Id.ToString() + ",") > -1)
|
||||
li.Selected = true;
|
||||
|
||||
_advancedUsersList.Items.Add(li);
|
||||
}
|
||||
|
||||
// add stylesheets
|
||||
foreach (cms.businesslogic.web.StyleSheet st in cms.businesslogic.web.StyleSheet.GetAll())
|
||||
{
|
||||
ListItem li = new ListItem(st.Text, st.Id.ToString());
|
||||
if (("," + _stylesheets + ",").IndexOf("," + st.Id.ToString() + ",") > -1)
|
||||
li.Selected = true;
|
||||
|
||||
_stylesheetList.Items.Add(li);
|
||||
}
|
||||
}
|
||||
|
||||
// Mark the current db type
|
||||
_dropdownlist.SelectedValue = _datatype.DBType.ToString();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Control Editor
|
||||
{
|
||||
get
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Save()
|
||||
{
|
||||
_datatype.DBType = (cms.businesslogic.datatype.DBTypes)Enum.Parse(typeof(cms.businesslogic.datatype.DBTypes), _dropdownlist.SelectedValue, true);
|
||||
|
||||
// Generate data-string
|
||||
string data = ",";
|
||||
|
||||
foreach (ListItem li in _editorButtons.Items)
|
||||
if (li.Selected)
|
||||
data += li.Value + ",";
|
||||
|
||||
data += "|";
|
||||
|
||||
if (_enableRightClick.Checked)
|
||||
data += "1";
|
||||
else
|
||||
data += "0";
|
||||
|
||||
data += "|";
|
||||
|
||||
foreach (ListItem li in _advancedUsersList.Items)
|
||||
if (li.Selected)
|
||||
data += li.Value + ",";
|
||||
|
||||
data += "|";
|
||||
|
||||
|
||||
data += "0|";
|
||||
/*
|
||||
if (_fullWidth.Checked)
|
||||
data += "1|";
|
||||
else
|
||||
data += "0|";
|
||||
*/
|
||||
|
||||
data += _width.Text + "," + _height.Text + "|";
|
||||
|
||||
foreach (ListItem li in _stylesheetList.Items)
|
||||
if (li.Selected)
|
||||
data += li.Value + ",";
|
||||
data += "|";
|
||||
data += _showLabel.Checked.ToString() + "|";
|
||||
data += _maxImageWidth.Text + "|";
|
||||
|
||||
|
||||
// If the add new prevalue textbox is filled out - add the value to the collection.
|
||||
IParameter[] SqlParams = new IParameter[] {
|
||||
SqlHelper.CreateParameter("@value",data),
|
||||
SqlHelper.CreateParameter("@dtdefid",_datatype.DataTypeDefinitionId)};
|
||||
SqlHelper.ExecuteNonQuery("delete from cmsDataTypePreValues where datatypenodeid = @dtdefid",SqlParams);
|
||||
// we need to populate the parameters again due to an issue with SQL CE
|
||||
SqlParams = new IParameter[] {
|
||||
SqlHelper.CreateParameter("@value",data),
|
||||
SqlHelper.CreateParameter("@dtdefid",_datatype.DataTypeDefinitionId)};
|
||||
SqlHelper.ExecuteNonQuery("insert into cmsDataTypePreValues (datatypenodeid,[value],sortorder,alias) values (@dtdefid,@value,0,'')",SqlParams);
|
||||
}
|
||||
|
||||
protected override void Render(HtmlTextWriter writer)
|
||||
{
|
||||
writer.WriteLine("<table>");
|
||||
writer.WriteLine("<tr><th>" + ui.Text("editdatatype", "dataBaseDatatype") + ":</th><td>");
|
||||
_dropdownlist.RenderControl(writer);
|
||||
writer.Write("</td></tr>");
|
||||
writer.Write("<tr><th>" + ui.Text("editdatatype", "rteButtons") + ":</th><td>");
|
||||
_editorButtons.RenderControl(writer);
|
||||
writer.Write("</td></tr>");
|
||||
writer.Write("<tr><th>" + ui.Text("editdatatype", "rteRelatedStylesheets") + ":</th><td>");
|
||||
_stylesheetList.RenderControl(writer);
|
||||
writer.Write("</td></tr>");
|
||||
writer.Write("<tr><th>" + ui.Text("editdatatype", "rteEnableContextMenu") + ":</th><td>");
|
||||
_enableRightClick.RenderControl(writer);
|
||||
writer.Write("</td></tr>");
|
||||
writer.Write("<tr><th>" + ui.Text("editdatatype", "rteEnableAdvancedSettings") + ":</th><td>");
|
||||
_advancedUsersList.RenderControl(writer);
|
||||
writer.Write("</td></tr>");
|
||||
writer.Write("<tr><th>");
|
||||
//"Size:</th><td>Maximum width and height: ");
|
||||
// _fullWidth.RenderControl(writer);
|
||||
|
||||
writer.Write(ui.Text("editdatatype", "rteWidthAndHeight") + ":</th><td>");
|
||||
_width.RenderControl(writer);
|
||||
_widthValidator.RenderControl(writer);
|
||||
writer.Write(" x ");
|
||||
_height.RenderControl(writer);
|
||||
_heightValidator.RenderControl(writer);
|
||||
writer.Write("</td></tr>");
|
||||
writer.Write("<tr><th>");
|
||||
writer.Write(ui.Text("editdatatype", "rteMaximumDefaultImgSize") + ":</th><td>");
|
||||
_maxImageWidth.RenderControl(writer);
|
||||
_maxImageWidthValidator.RenderControl(writer);
|
||||
writer.Write("</td></tr>");
|
||||
writer.Write("<tr><th>" + ui.Text("editdatatype", "rteShowLabel") + ":</th><td>");
|
||||
_showLabel.RenderControl(writer);
|
||||
writer.Write("</td></tr>");
|
||||
writer.Write("</table>");
|
||||
}
|
||||
|
||||
public string Configuration
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return SqlHelper.ExecuteScalar<string>("select value from cmsDataTypePreValues where datatypenodeid = @datatypenodeid", SqlHelper.CreateParameter("@datatypenodeid", _datatype.DataTypeDefinitionId));
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
@@ -383,22 +383,9 @@
|
||||
<Compile Include="textfield\TextFieldDataType.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tinymce\tinyMCEConfiguration.cs" />
|
||||
<Compile Include="tinymce\tinyMCEImageHelper.cs" />
|
||||
<Compile Include="tinymce\tinyMCEPreValueConfigurator.cs" />
|
||||
<Compile Include="userControlWrapper\SerializationHelper.cs" />
|
||||
<Compile Include="userControlWrapper\usercontrolData.cs" />
|
||||
<Compile Include="wysiwyg\editorButton.cs" />
|
||||
<Compile Include="tinyMCE3\TinyMCE.cs" />
|
||||
<Compile Include="tinyMCE3\tinyMCE3dataType.cs" />
|
||||
<Compile Include="tinyMCE3\webcontrol\plugin\ConfigSection.cs" />
|
||||
<Compile Include="tinyMCE3\webcontrol\plugin\GzipCompressor.cs" />
|
||||
<Compile Include="tinyMCE3\webcontrol\plugin\GzipModule.cs" />
|
||||
<Compile Include="tinyMCE3\webcontrol\plugin\IModule.cs" />
|
||||
<Compile Include="tinyMCE3\webcontrol\plugin\JSON.cs" />
|
||||
<Compile Include="tinyMCE3\webcontrol\plugin\JSONReader.cs" />
|
||||
<Compile Include="tinyMCE3\webcontrol\plugin\JSONWriter.cs" />
|
||||
<Compile Include="tinyMCE3\webcontrol\TinyMCEWebControl.cs" />
|
||||
<Compile Include="ultimatepicker\ultimatePickerDataEditor.cs" />
|
||||
<Compile Include="ultimatepicker\ultimatePickerDataType.cs" />
|
||||
<Compile Include="ultimatepicker\ultimatePickerPrevalueEditor.cs" />
|
||||
|
||||
Reference in New Issue
Block a user