-
Notifications
You must be signed in to change notification settings - Fork 20
/
Template.ascx.cs
67 lines (62 loc) · 2.32 KB
/
Template.ascx.cs
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
using System;
using DotNetNuke.Common;
using DotNetNuke.Modules.UserDefinedTable.Templates;
using DotNetNuke.UI.Modules;
namespace DotNetNuke.Modules.UserDefinedTable
{
/// -----------------------------------------------------------------------------
/// <summary>
/// Editor for Module templates (aka Module Applications)
/// </summary>
/// -----------------------------------------------------------------------------
public partial class Template : ModuleUserControlBase
{
protected void cmdSaveFile_Click(object sender, EventArgs e)
{
if (TemplateController.SaveTemplate(txtTitle.Text, txtDescription.Text, ModuleContext, false,
MaxNumberOfRecords()))
{
Response.Redirect(Globals.NavigateURL(ModuleContext.TabId), true);
}
else
{
panConfirm.Visible = true;
panSave.Visible = false;
cmdSaveFile.Enabled = false;
txtDescription.Enabled = false;
txtTitle.Enabled = false;
}
}
protected void cmdConfirmOverwriteFile_Click(object sender, EventArgs e)
{
TemplateController.SaveTemplate(txtTitle.Text, txtDescription.Text, ModuleContext, true,
MaxNumberOfRecords());
Response.Redirect(Globals.NavigateURL(ModuleContext.TabId), true);
}
protected void cmdDenyOverwriteFile_Click(object sender, EventArgs e)
{
cmdSaveFile.Enabled = true;
panSave.Visible = true;
txtDescription.Enabled = true;
txtTitle.Enabled = true;
txtTitle.Text = "";
panConfirm.Visible = false;
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
cmdConfirmOverwriteFile.Click += cmdConfirmOverwriteFile_Click;
cmdDenyOverwriteFile.Click += cmdDenyOverwriteFile_Click;
cmdSaveFile.Click += cmdSaveFile_Click;
}
int MaxNumberOfRecords()
{
int returnValue;
if (! int.TryParse(txtNumbers.Text, out returnValue))
{
returnValue = 1;
}
return returnValue;
}
}
}