help.axcms.netAxinom Logo
Save Save Chapter Send Feedback

Upgrading to AxCMS.net ver8.3.0

 

Breaking Newsletter and MailTemplate refactorings

Newsletter and MailTemplate processing and sending out was strongly refactored. Major changes are:

  • Removal of NewsletterWebService
  • Removal of NewsletterSyndication namespace
  • AxMailPageBase class encapsulating functionality for processing and sending our both mailtemplates and newsletters - base class for AxNewsletter and AxMailTemplate
  • New approach to sending MailTemplates
  • Moving of NewsletterQueueTask to LS context

These changes will mostly affect your code if you have used mail templates. Before you had to call NewsletterWebService several times to retrieve the HTML of the template, mail template details, macros, subscriber details, etc. Now the same functionality is encapsulated in AxMailTemplate class itself - so all you need to send out the mail template is to call Send method:

myMailTemplate.Send(myMailer, mySubscriber, myResourceManager);

If you need to customize the mail message beyond standard functionality (e.g. add extra headers, etc.), you have to override AxMailTemplate class (with [OverridesAxMailTemplate] attribute) and override methods you need from base AxMailTemplate class. You can also override AxNewsletter class (with [OverridesAxNewsletter] attribute) to do customize newsletters (e.g. to add additional subscribers).

You have to remove all calls to NewsletterWebService and classes from NewsletterSyndication namespace and replace the old logic with the new one in your custom code. If you are using NewsletterOptions section in publishService web.config then this has to be moved to both LS and MS web.configs. Section declaration is changed from

<section name="NewsletterOptions" type="Axinom.AECMS.NewsletterSyndication.NewsletterOptions, AxCMS.BL"/> to
<section name="NewsletterOptions" type="Axinom.AECMS.page.NewsletterOptions, AxCMS.BL"/>

You will also need updated version of ContactModule and any other modules that use the old logic to send out mails.

Why to refactor:

  • Simplify the architecture
  • Encapsulate logic for both mailtemplates and newsletters
  • Provide easier way to customize processing and sendout for both newsletters and mailtemplates
  • Add same support for macros as in newsletter to usual pages
  • Provide a way for an editor to send test newsletter - clicking Test newsletter button will send the newsletter generated in MS context to all MS users from newsletter categories
  • Provide a way to send out text version of the newsletter or mailtemplate - editor can define plain text version of the mail in the newsletter or mail template detail and it will be sent to all users categories in "Plain text mails" category
  • Extend the newsletters and mailtemplates with CC and BCC fields

NB! After refactoring there is a need to do some changes in your project Create application.

[Project_Name]Application.cs following lines need to be replaced:

Find:

// LS
DeleteTables(
"AxRelation,AxDocument,AxPage,AxUserRight,AxUserMembership," +
"AxIndexKeyword,AxIndexText,AxServiceTask,AxTrackedLink",
_lsConnectionManager
);

Replace with:

// LS
DeleteTables(
"AxRelation,AxDocument,AxPage,AxUserRight,AxUserMembership," +
"AxIndexKeyword,AxIndexText,AxTrackedLink",
_lsConnectionManager
);

query = new DbDeleteQuery("AxServiceTask");
query.ConnectionManager = _lsConnectionManager;
query.AddWhere("AxID > 2");
query.ExecuteNonQuery();


New code will not empty AxServiceTask table in LS database and doesn't let to delete Newsletter service task from LS database. For troubleshooting: first thing you should check, if there is row for NewsletterQueue task in LS database AxServiceTask table.

Also please update your Live-System config files and copy there key with CMSInstance name. From now on there is a need of this value also in LS. This line should be in both configs:

<add key="CMSInstanceName" value="[PROJECT_NAME]" />

Multsite redirect page

Starting from version 8.3.0 the DefaultMultisites.aspx page is not used anymore for multi site option. New logic will always use Default.aspx page. If any start page is specified for particular site, there will be redirect from Default.aspx to specified page, in any other way user will be redirected to default home page defined in configuration.

Custom alerts

Since 8.1.2 it is possible to subscribe to alerts for different CMS activities. Now it is also possible for developer to create their own alerts. Simplest alert class would be:

public class MyAlert: AxAlert {}

This will be enough for MyAlert alert to be available in alert subscription. However, you can override some methods in AxAlert class to customize behavior and look of the alert

The standard way to trigger an alert is this (but you can implement your own overloads when necessary):

new MyAlert().Trigger(currentUser, pages);

ContactModule

There was an update of this module. Current latest version of it is 3.3. If you use it in your custom project, please update this library and templates with latest version.

Multiple select for overview in popup mode

You can now specify multiple select for overview in popup mode by specifying Request parameter Select with value 2 (previously 0 or 1). Selected values will be passed through same method, but now, instead of just passing one value, values will be separated by comma.

From this version control over the multi-selection grid will be done in GridOverviewCMSPage class, so if you set multi-selection inside specific overview, please remove lines like this:

if(this.PopupMode == PopupMode.Popup)
{
_grid.MultiSelectMode = false;
}
else
{
_grid.MultiSelectMode = true;
}

There is change in BaseTemplatePage class SelectMode property type. It changed from bool to public enum SelectMode. So if you used it in your custom overviews, please change its value as follow:

SelectMode.Single - single select mode
SelectMode.Multi - multi select mode
SelectMode.None - no selection possible mode

New language format supported

Starting from this version it is possible to set language abbreviations in new and more flexible manner.

New approach is: {language}-{COUNTRY} (e.g. en-US, en-UK, de-CH, de-AT, ee-ET), where {language} is a lowercase two-letter code derived from ISO 639-1 and {COUNTRY} is an uppercase two-letter code derived from ISO 3166.

Example of usage in resource manager:

<ResourceManager name="CMS">
<DefaultLanguage>ax</DefaultLanguage>
<Languages>en-US,de-CH,de-DE,ax,ru,et</Languages>
<InsertLanguage>true</InsertLanguage>
<IsEditable>true</IsEditable>
<Notification>false</Notification>
<Table>CMS</Table>
</ResourceManager>

As you can notify there is no need to change your current language abbreviations, but in future you can extend functionality of your site with country specific languages.

If system will not be able to find exact match of language, it will also try to parse out first two letters and try to find match then. For example: if passed language will be "ru-RU", system will match "ru" in above example of  resource manager.