Repository navigation
Expand file tree
/
Copy pathTextEditorControl.cs
More file actions
57 lines (49 loc) · 1.88 KB
/
Copy pathTextEditorControl.cs
File metadata and controls
57 lines (49 loc) · 1.88 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System.Collections.Specialized;
using System.Web;
using System.Web.UI;
using SiteServer.BackgroundPages.Core;
using SiteServer.CMS.Model;
namespace SiteServer.BackgroundPages.Controls
{
public class TextEditorControl : Control
{
private NameValueCollection _formCollection;
private bool _isEdit;
private bool _isPostBack;
private PublishmentSystemInfo _publishmentSystemInfo;
private string _attributeName;
public void SetParameters(PublishmentSystemInfo publishmentSystemInfo, string attributeName, NameValueCollection formCollection, bool isEdit, bool isPostBack)
{
_publishmentSystemInfo = publishmentSystemInfo;
_attributeName = attributeName;
_formCollection = formCollection;
_isEdit = isEdit;
_isPostBack = isPostBack;
}
protected override void Render(HtmlTextWriter output)
{
if (!Page.IsPostBack)
{
if (_formCollection == null)
{
if (HttpContext.Current.Request.Form.Count > 0)
{
_formCollection = HttpContext.Current.Request.Form;
}
else
{
_formCollection = new NameValueCollection();
}
}
var pageScripts = new NameValueCollection();
var isAddAndNotPostBack = !_isEdit && !_isPostBack;
var inputHtml = BackgroundInputTypeParser.ParseTextEditor(_publishmentSystemInfo, _attributeName, _formCollection, isAddAndNotPostBack, pageScripts, string.Empty, string.Empty, 0);
output.Write(inputHtml);
foreach (string key in pageScripts.Keys)
{
output.Write(pageScripts[key]);
}
}
}
}
}