Nik's Technology Blog

Travels through programming, networks, and computers

Developing Scheduled Tasks for Immediacy Management Console (Alterian CMC)

Immediacy Management Console Scheduled Tasks are useful for running tasks that need to occur automatically on a frequent basis which are independent of website visitor actions.

immediacy-mc

These scheduled tasks have the advantage of being able to hook up to the Immediacy API, allowing developers to perform tasks on Immediacy pages etc.

Scheduled tasks can have public properties if required, which are entered via a Plug-in Settings dialog box.

immediacy-mc-settings

Plug-in Development

Immediacy Management Console plug-ins are simply a .NET class library. The project should contain a C# or VB.NET file containing the plug-in and a separate class which defines the Plug-in Settings dialog.

The plug-in class needs to reference the following Immediacy namespaces.

Immediacy.Configuration;
Immediacy.Service.Interfaces;

Your plug-in class needs to inherit from:

Immediacy.Service.Interfaces.Plugin

And your class needs to have a few class attributes for Immediacy (CMC) to recognise your plug-in:

    [SettingsControlTypeAttribute(typeof(SiteMapSettings))]
    [GuidAttribute("XXXX8D90-XXXX-XXXX-XXXX-A3341127XXXX")]
    [PluginDetailsType("Name of Plug-in", "Description")]

Your plug-in class constructor needs to pass the settings to the base class as follows:

public Sitemap(ImcFile imcFile, StringDictionary settings) : base(imcFile, settings) { }

To build your plug-in you need to override the Execute() method and put your code in here.

Plug-in Settings Dialog Development


The plug-in settings dialog is created by another class, which inherits from Immediacy.Service.Interfaces.SettingsControl

This class is essentially a Windows Form code file without the form designer, so you’ll need to import the  System.Windows.Forms namespace.

You’ll need to add Windows.Forms Labels and TextBoxes to the dialog box to capture the public properties from the user who configures the plug-in while scheduling it.

Implement the abstract class like the example below:

 

namespace ImmPlugins.Sitemap

{

    public class SettingTest : Immediacy.Service.Interfaces.SettingsControl

    {

        private System.Windows.Forms.TextBox txtUrl;

  private System.Windows.Forms.Label lblUrl;

 

  private System.ComponentModel.Container components = null;

 

        public SiteMapSettings(Type pluginType)

            : base(pluginType)

        {

            InitializeComponent();

        }

 

        public override System.Collections.Specialized.StringDictionary Settings

        {

            get

            {

                StringDictionary retVal = new StringDictionary();

                retVal.Add("url", txtUrl.Text);

                return retVal;

            }

            set

            {

                txtUrl.Text = (string)value["url"];

            }       

  }

 

        public override bool SettingsAreValid

        {

            get {

                  if (txtUrl.Text == “”)

                  {

return false;

                  }

                  else

                  {

                        return true;

                  }

}

        }

 

        public override string SettingsAreValidVerbose

        {

            get {

string errorText = string.Empty;

                  if (txtUrl.Text == "")

                  {

errorText += "Please specify a URL \r\n";                 

}

return errorText;
}

        }

 

        private void InitializeComponent()

        {

            this.lblUrl = new System.Windows.Forms.Label();

            this.txtUrl = new System.Windows.Forms.TextBox();

 

            this.txtUrl.Location = new System.Drawing.Point(202, 59);

            this.txtUrl.Name = "txtUrl";

            this.txtUrl.Size = new System.Drawing.Size(160, 20);

            this.txtUrl.TabIndex = 2;

 

            this.lblUrl.Location = new System.Drawing.Point(8, 59);

            this.lblUrl.Name = "lblUrl";

            this.lblUrl.Size = new System.Drawing.Size(188, 16);

            this.lblUrl.TabIndex = 1;

            this.lblUrl.Text = "URL:";

 

this.ClientSize = new System.Drawing.Size(374, 183);

            this.Controls.Add(this.lblUrl);

            this.Controls.Add(this.txtUrl);

            this.Name = "PluginSettings";

            this.ResumeLayout(false);

            this.PerformLayout();

        }

 

        protected override void Dispose(bool disposing)

        {

            if (disposing)

            {

                if (components != null)

                {

                    components.Dispose();

                }

            }

            base.Dispose(disposing);

        }

    }

}

Plug-in Installation


Immediacy Management Console plug-ins are installed in the Immediacy CMS folder path.

Simply compile your .NET class library to a DLL and copy it to this directory.

e.g. C:\Program Files\Immediacy\CMS\6.1\Service\Plugins

(Note: This path maybe slightly different on your installation depending on Immediacy version, drive path etc)

If all has gone well your plug-in should show up in the list of tasks which can be scheduled in the Immediacy Management Console.

Adsense for Domains - Fasthosts Setup

Until recently you couldn't take advantage of Adsense for Domains if you registered a domain name with Fasthosts.  However, with the new Fasthosts control panel which now allows you to edit DNS settings, domain name owners can now earn revenue from domain names they don't currently use.

If you're familiar with Google Adsense, you may have seen the "Adsense for Domains" link on the "Adsense Setup" tab on the Adsense navigation.  Unfortunately the "Quick start guide" Google provides doesn't include instructions for Fasthosts setup and following the generic instructions doesn’t work either.

The solution

Log-in to your Fasthosts control panel and click on the “DNS” button for the domain you wish to use to park with Adsense for Domains.

Find your "unique identifier" from the Adsense for Domains page within Adsense and create a CNAME as follows:

Host Name: www

Points to: your adsense unique identifier e.g pub-xxxxxxxxxxxxxxafd.ghs.google.com.

Next create an A record as follows:

Host Name: leave blank

Points to: 216.239.32.21

See the screenshot below for a finished example…

fasthosts