help.axcms.netAxinom Logo
Save Save Chapter Send Feedback

Customizing ContactModule

 

List Customizations

You can write own ICustomLoader classes to define, what a ListControl (DropDown, CheckBoxList, RadioButtonList) should display, when user selects not to show the child categories of selected category, but to show pages and documents.

If not defined, BasicLoader is used which just displays all pages assigend to the subtree of selected category.

You can define a custom loader for each ListControl.

public interface ICustomLoader
{
ListItemCollection GetListItems(Category cat);
}

ContactFormProcessor (optional)

You can write an own IContactFormProcessor. When user clicks send button, the function Process of your processor is called. You can then implement e.g. saving data to DB.

public interface IContactFormProcessor
{
bool Process(
AxUser loggedInUser, // null, if no user is logged in
NameValueCollection formData, // name-value pairs for each form field
int currentPage, // ID of the page where the form is placed into;
int? currentNavigation, // ID of the navigation point, which was clicked to call the currentPage ("activeID");
                        // null if no navigation point exists (e.g. page is called directly and is not assigned to any navigation point
int? referrerPage, // ID of the page, from which the user came to the current page, if any
int? referrerNavigation // ID of the navigation point of the referrer page, if any
);
}

CustomMailer

You can override mailsending functionality of ContactModule by implementing class inheriting ICustomMailer. If you want to use default mail functions for either SendUserMail or SendEditorMail, create instance of ConfirmMail(info) and use it's SendUserMail or SendEditorMail functions.

public interface ICustomMailer
{
bool SendUserMail(string mailtemplateurl, string fromEmail, ContactFormInformation info);
bool SendEditorMail(string fromEmail, string toEmail, string subject, Collection<string> attachments, ContactFormInformation info);
}

Prefill from Request

The contact controls read now their default value from request. Please add as key the value, the user defined as "Bezeichnung". For DropDowns and RadioButtonList set the value of listitem as value. For Checkboxes, you can set multiple values seperated by ','. For SalutationControl, set the gender enum. For Button you can define a "to-email" -> the email address, the button should send an email to. Please add key "send" for this. The email must be encoded. We encode each character in the email string to byte and write the byte.ToString() and seperate the bytes with ','. You can use the function ContactModuleContext.EncodeEmail(email) for this. And please ensure that you encode your url. The prefilling from request works in LS, in CMS the url is wrong decoded because of the AxCMS.net custom handling.