forked from siteserver/cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextEditorControl.cs
More file actions
42 lines (34 loc) · 1.12 KB
/
Copy pathTextEditorControl.cs
File metadata and controls
42 lines (34 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Collections.Specialized;
using System.Text;
using System.Web.UI;
using SiteServer.BackgroundPages.Core;
using SiteServer.CMS.Model;
namespace SiteServer.BackgroundPages.Controls
{
public class TextEditorControl : Control
{
private string _value;
private SiteInfo _siteInfo;
private string _attributeName;
public void SetParameters(SiteInfo siteInfo, string attributeName, string value)
{
_siteInfo = siteInfo;
_attributeName = attributeName;
_value = value;
}
protected override void Render(HtmlTextWriter output)
{
if (Page.IsPostBack) return;
var pageScripts = new NameValueCollection();
var attributes = new ExtendedAttributes();
attributes.Set(_attributeName, _value);
var extraBuilder = new StringBuilder();
var inputHtml = BackgroundInputTypeParser.ParseTextEditor(attributes, _attributeName, _siteInfo, pageScripts, extraBuilder);
output.Write(inputHtml + extraBuilder);
foreach (string key in pageScripts.Keys)
{
output.Write(pageScripts[key]);
}
}
}
}