-
Notifications
You must be signed in to change notification settings - Fork 20
/
ShowXml.ashx.cs
78 lines (69 loc) · 2.78 KB
/
ShowXml.ashx.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
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Entities.Users;
using DotNetNuke.Modules.UserDefinedTable.Components;
using DotNetNuke.Security.Permissions;
namespace DotNetNuke.Modules.UserDefinedTable
{
/// <summary>
/// Summary description for ShowXml
/// </summary>
public class ShowXml : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
try
{
PortalController.Instance.GetCurrentPortalSettings();
if ((context.Request.QueryString["tabid"] == null || context.Request.QueryString["mid"] == null) ||
!(context.Request.IsAuthenticated))
{
return;
}
// get TabId
var tabId = Convert.ToInt32(-1);
if (context.Request.QueryString["tabid"] != null)
{
tabId = int.Parse(context.Request.QueryString["tabid"]);
}
// get ModuleId
var moduleId = Convert.ToInt32(-1);
if (context.Request.QueryString["mid"] != null)
{
moduleId = int.Parse(context.Request.QueryString["mid"]);
}
var userInfo = UserController.Instance.GetCurrentUserInfo();
var mc = new ModuleController();
var moduleInfo = new ModuleController().GetModule(moduleId, tabId);
var settings = moduleInfo.ModuleSettings;
if (ModulePermissionController.CanManageModule(moduleInfo))
{
var udt = new UserDefinedTableController(moduleId, tabId, userInfo);
var ds = udt.GetDataSet(true);
ds.Tables.Add(udt.Context(moduleInfo, userInfo,
context.Request[Definition.QueryStringParameter].AsString(),
settings[SettingName.SortField].AsString(),
settings[SettingName.SortOrder].AsString(),
settings[SettingName.Paging].AsString()));
context.Response.ContentType = "Text/Xml";
ds.WriteXml(context.Response.OutputStream);
}
}
catch (Exception)
{
context.Response.Write("Not defined");
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
}