Glossary Item Box

Modules: Modules

API: Client-side API

Controls: Controls

See Also CmsDeveloperGuide Send comments on this topic.

Custom module

Custom module is intended to extend Astron SiteManager opportunities. Using it you can extend your site features.


A template file for this module lies in a modules/customModule folder and looks as follows:

<%@ Control Language="c#" Inherits="CMSLib.Pages.SiteControl" %>
<%@ Register TagPrefix="cms" Namespace="CMSLib.Modules.CustomModule" Assembly="CMSLib" %>

<cms:CustomModule id="CustomModule1" runat="server" />

 

A template of this module doesn’t need to be tuned.

 

Creating your CustomModule

 
To extend your site features you can create your own CustomeModule. CustomeModule is a UserControl which is inherited from CMSLib.Pages.SiteControl.UserControl control and parameters are set through the CMS administrative interface. To get CustomModule parameters you can use static function CustomModule.GetParams (returns parameters as a string) and CustomModule.GetParamsAsHashtable (returns parameters as a Hashtable).
 
A CustomModule example (you define a place where it is kept through the CMS administrative interface):

<%@ Control Language="c#" Inherits="CMSLib.Pages.SiteControl" %>

<script runat="server" language="c#">

/// <summary>
/// Send e-mail message
/// </summary>
private void Send(object sender, System.EventArgs e)
{
 CMSLib.BLL.MailUtil.Send("Form request",
        "Date: " + DateTime.Now.ToString() + ", " +
        "E-mail: " + txtEmail.Text + "\n" + "\n" +
        txtQuest.Text);

 pnlForm.Visible = false;
 pnlRequestSended.Visible = true;
}

</script>

<asp:Panel id="pnlForm" runat="server">
<h1>Form</h1>

<p><%= CMSLib.Modules.CustomModule.CustomModule.GetParams() %></p>

E-mail: <asp:TextBox id=txtEmail runat="server" /><br />
Text: <asp:TextBox id=txtQuest runat="server" Columns="80" TextMode="MultiLine" Rows="15" width="600"></asp:TextBox><br />
<asp:Button id=btnSend runat="server" Text="Send" onClick="Send"></asp:Button>
</asp:Panel>

<asp:Panel id="pnlRequestSended" runat="server" Visible="False">
The message is sent
</asp:Panel>

Modules: Modules

API: Client-side API

Controls: Controls

 

 


© 2005-2007 Astron Digital Ltd. All Rights Reserved.