forked from 2sic/2sxc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EditTemplateFile.ascx
81 lines (72 loc) · 3.92 KB
/
EditTemplateFile.ascx
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EditTemplateFile.ascx.cs" Inherits="ToSic.SexyContent.EditTemplateFile" %>
<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
<%@ Register TagPrefix="dnnweb" Assembly="DotNetNuke.Web" Namespace="DotNetNuke.Web.UI.WebControls" %>
<div class="dnnForm dnnEditTemplateFile dnnClear">
<h2 class="dnnFormSectionHead" runat="server" id="dnnSitePanelSexyContentEditTemplateFile">
<a href="#"><asp:Label runat="server" ID="lblEditTemplateFileHeading"></asp:Label></a></h2>
<fieldset>
<div class="dnnFormItem">
<div class="dnnClear">
<asp:TextBox CssClass="sc-txt-templatecontent" runat="server" ID="txtTemplateContent" TextMode="MultiLine" Rows="20" Wrap="false" Width="97%"></asp:TextBox>
</div>
</div>
<ul class="dnnActions dnnClear">
<li><asp:LinkButton runat="server" ID="btnUpdate" ResourceKey="btnUpdate" OnClick="btnUpdate_Click" CssClass="dnnPrimaryAction"></asp:LinkButton></li>
<li><asp:HyperLink runat="server" ID="hlkCancel" ResourceKey="hlkCancel" CssClass="dnnSecondaryAction"></asp:HyperLink></li>
</ul>
</fieldset>
<h2 class="dnnFormSectionHead" runat="server" id="dnnSitePanelTemplateHelp"><a href="#">
<asp:Label runat="server" ID="lblTemplateHelpHeader" ResourceKey="lblTemplateHelpHeader"></asp:Label></a>
</h2>
<fieldset>
<div class="dnnFormItem">
<dnn:Label runat="server" ID="plCurrentTemplate" ResourceKey="plCurrentTemplate" HelpKey="plCurrentTemplate.HelpText" ControlName="lblTemplate" Suffix=":" />
<asp:Label runat="server" ID="lblTemplate"></asp:Label>
</div>
<div class="dnnFormItem">
<dnn:Label runat="server" ID="plTemplateLocation" ResourceKey="plTemplateLocation" HelpKey="plTemplateLocation.HelpText" ControlName="lblTemplate" Suffix=":" />
<asp:Label runat="server" ID="lblTemplateLocation"></asp:Label>
</div>
<div class="dnnFormItem">
<asp:Label runat="server" ID="lblTableDescription" ResourceKey="lblTableDescription"></asp:Label>
</div>
<asp:PlaceHolder runat="server" ID="phGrids"></asp:PlaceHolder>
</fieldset>
</div>
<script type="text/javascript">
jQuery(function ($) {
var setupModule = function () {
$('.dnnEditTemplateFile').dnnPanels();
if ($(".dnnForm fieldset:visible").size() != 2) {
$("<a />").dnnExpandAll({
targetArea: '.dnnEditTemplateFile'
}).trigger("click");
}
};
setupModule();
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function () {
// note that this will fire when _any_ UpdatePanel is triggered,
// which may or may not cause an issue
setupModule();
});
});
$(document).delegate('.sc-txt-templatecontent', 'keydown', function (e) {
var keyCode = e.keyCode || e.which;
if (keyCode == 9) {
e.preventDefault();
var start = $(this).get(0).selectionStart;
var end = $(this).get(0).selectionEnd;
// set textarea value to: text before caret + tab + text after caret
$(this).val($(this).val().substring(0, start)
+ "\t"
+ $(this).val().substring(end));
// put caret at right position again
$(this).get(0).selectionStart =
$(this).get(0).selectionEnd = start + 1;
}
});
</script>
<style type="text/css">
.grdFields { margin-bottom: 10px; }
.sc-txt-templatecontent { max-width:none!important;font-family: "Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro", monospace; -moz-tab-size:4;-ms-tab-size: 4; -o-tab-size:4; tab-size:4; }
</style>