-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathAnnouncementsView.ascx.cs
86 lines (73 loc) · 3.42 KB
/
AnnouncementsView.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using System;
using System.IO;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Modules.Announcements.Components.Common;
using DotNetNuke.Modules.Announcements.Components.Template;
using DotNetNuke.Modules.Announcements.MVP.Models;
using DotNetNuke.Modules.Announcements.MVP.Presenters;
using DotNetNuke.Modules.Announcements.MVP.Views;
using DotNetNuke.Security;
using DotNetNuke.Services.Localization;
using DotNetNuke.Web.Client.ClientResourceManagement;
using DotNetNuke.Web.Mvp;
using WebFormsMvp;
namespace DotNetNuke.Modules.Announcements
{
[PresenterBinding(typeof(AnnouncementsViewPresenter))]
public partial class AnnouncementsView : ModuleView<AnnouncementsViewModel>, IAnnouncementsView, IActionable
{
public event EventHandler GetSettings;
public event EventHandler GetAnnouncements;
public event EventHandler GetPermissions;
public event EventHandler GetTemplate;
public event EventHandler GetRenderedTemplate;
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
GetSettings(this, EventArgs.Empty);
GetPermissions(this, EventArgs.Empty);
GetAnnouncements(this, EventArgs.Empty);
GetTemplate(this, EventArgs.Empty);
GetRenderedTemplate(this, EventArgs.Empty);
litAnnouncements.Text = Model.RenderedTemplate;
var localTemplate = (BaseTemplate)Model.Template;
if (!string.IsNullOrEmpty(localTemplate.JsFile) && File.Exists(Server.MapPath(localTemplate.JsFile)))
{
// Framework.jQuery.RegisterJQuery(Page);
// Should not be required, jQuery is loaded by default
ClientResourceManager.RegisterScript(Page, localTemplate.JsFile);
}
if (!string.IsNullOrEmpty(localTemplate.CssFile) && File.Exists(Server.MapPath(localTemplate.CssFile)))
{
ClientResourceManager.RegisterStyleSheet(Page, localTemplate.CssFile);
}
}
#region IActionable Implementation
/// -----------------------------------------------------------------------------
/// <summary>
/// Gets the modules custom Actions
/// </summary>
/// -----------------------------------------------------------------------------
public ModuleActionCollection ModuleActions
{
get
{
var actionCollection = new ModuleActionCollection
{
{
ModuleContext.GetNextActionID(), Localization.GetString(ModuleActionType.AddContent, LocalResourceFile),
ModuleActionType.AddContent, "", "add.gif", ModuleContext.EditUrl(), false, SecurityAccessLevel.Edit, true, false
}
};
var moduleSecurity = new ModuleSecurity(ModuleContext.Configuration);
if (moduleSecurity.HasEditTemplatePermission)
{
actionCollection.Add(ModuleContext.GetNextActionID(), Localization.GetString("TemplateConfiguration.Action", LocalResourceFile), "Template", "", "icon_configuration_16px.png", ModuleContext.EditUrl("Template"), false, SecurityAccessLevel.View, true, false);
}
return actionCollection;
}
}
#endregion
}
}