I just added a Codesmith template that can generate a starter SiteModuleControl using inline code instead of a codebehind file, so its all contained in one file. I suspect this is the easiest point of entry for a new developer to implement a custom mojoportal feature. I still generally prefer the code behind/compiled into the dll in the bin model, but some may find the inline code approach easier to understand. Using the new Codesmith template you an generate one using your own class names and file names but really you could juts edit this which is an example of the generated control:
<%@ Control Language="C#" ClassName="MyCustomSiteModule.ascx" Inherits="mojoPortal.Web.SiteModuleControl" %>
<%@ Import Namespace="mojoPortal.Business" %>
<%@ Import Namespace="mojoPortal.Business.WebHelpers" %>
<%@ Import Namespace="mojoPortal.Web.Framework" %>
<%@ Import Namespace="mojoPortal.Web.Controls" %>
<%@ Import Namespace="mojoPortal.Web.Editor" %>
<%@ Import Namespace="mojoPortal.Net" %>
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
}
protected void Page_Load(object sender, EventArgs e)
{
LoadSettings();
PopulateLabels();
PopulateControls();
}
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = "Hello Web";
}
private void PopulateControls()
{
TextBox1.Text = "Click the button";
}
private void PopulateLabels()
{
}
private void LoadSettings()
{
// TODO: if yous feature has an edit page link to it here
//Title1.EditUrl = SiteRoot + "/MyClassEdit.aspx";
//Title1.EditText =
Title1.Visible = !this.RenderInWebPartMode;
if (this.ModuleConfiguration != null)
{
this.Title = this.ModuleConfiguration.ModuleTitle;
this.Description = this.ModuleConfiguration.FeatureName;
}
}
</script>
<mp:CornerRounderTop id="ctop1" runat="server" />
<asp:Panel ID="pnlWrapper" runat="server" CssClass="panelwrapper linksmodule">
<portal:ModuleTitleControl id="Title1" runat="server" />
<asp:Panel ID="pnlMyClass" runat="server" EnableViewState="false" CssClass="modulecontent">
Your custom form goes here.
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</asp:Panel>
<div class="modulefooter"></div>
</asp:Panel>
<mp:CornerRounderBottom id="cbottom1" runat="server" />
Its a basic hello world example that you can modify to create a custom feature. You would then drop the control into the Web/Modules folder then "install" it from (Key icon) Administration Menu > Advanced Tools > Feature Installation by entering a nem for it and the path to the control.
So you would just add whatever needed asp.net controls and code to capture your data and send an email.
Hope it helps,
Joe