Menu

[r1]: / trunk / Source / Modules / Static / StaticModule.cs  Maximize  Restore  History

Download this file

73 lines (65 with data), 2.5 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#region Copyright © 2004, Nicholas Berardi
/*
* ManagedFusion (www.ManagedFusion.net) Copyright © 2004, Nicholas Berardi
* All rights reserved.
*
* This code is protected under the Common Public License Version 1.0
* The license in its entirety at <http://opensource.org/licenses/cpl.php>
*
* ManagedFusion is freely available from <http://www.ManagedFusion.net/>
*/
#endregion
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
// ManagedFusion Classes
using ManagedFusion;
using ManagedFusion.Security;
using ManagedFusion.Modules;
using Atom.Core;
namespace OmniPortal.Modules.Static
{
[Module("Static Page",
"The static module is used inorder to display static content to the page.",
"{8B61FD65-C060-46f2-AC29-5A4669D010AC}")]
public class StaticModule : ModuleBase
{
protected override void OnLoadSyndication(LoadSyndicationEventArgs e)
{
// add the item
AtomEntry entry = new AtomEntry();
entry.Author = new AtomPersonConstruct("author", "Unknown");
entry.Title = new AtomContentConstruct("title", this.SectionInformation.Title);
entry.Links.Add(new AtomLink(this.SectionInformation.UrlPath, Relationship.Alternate, MediaType.TextHtml));
entry.Id = this.SectionInformation.UrlPath;
entry.Modified = new AtomDateConstruct("modified", this.SectionInformation.Touched);
entry.Issued = new AtomDateConstruct("issued", DateTime.Now);
entry.Contents.Add(new AtomContent(this.Properties["Content"], MediaType.TextHtml, Mode.Escaped));
// add entry to the feed
e.Feed.Entries.Add(entry);
}
protected override void OnLoad(LoadModuleEventArgs e)
{
#if DEBUG
Context.Trace.Write("StaticModule", "QueryString Edit Present: " + (Context.Request.QueryString["edit"] != null));
#endif
// checks to see if user is an administrator and is in edit mode
if (Context.Request.QueryString["edit"] != null && IsInTask("Editor"))
e.CenterTop.Add(new Edit());
else
{
// add edit button for users with access to edit
if (IsInTask("Editor"))
{
HyperLink editLink = new HyperLink();
editLink.Text = "Edit This Page's Content";
editLink.NavigateUrl = Common.Path.GetPortalUrl("Edit.aspx").ToString();
// add link to page
e.CenterTop.AddAt(0, editLink);
}
// add body of page
e.CenterTop.Add(new LiteralControl(this.Properties["Content"]));
}
}
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.