Hello Peter,
Is it possible. I have almost the same on one of the pages. You need to use Global Events,
here's my snippet of my code:
using CMS.Base;
using CMS.DocumentEngine;
using CMS.Helpers;
using System;
using System.Globalization;
/// <summary>
/// Summary description for RedakcjeHandler
/// </summary>
[RedakcjeHandler]
public partial class CMSModuleLoader
{
private class RedakcjeHandler : CMSLoaderAttribute
{
public override void Init()
{
DocumentEvents.Insert.Before += Document_Insert_Before;
}
void Document_Insert_Before(object sender, DocumentEventArgs e)
{
TreeNode doc = e.Node;
if (doc.ClassName.ToLower() == "ministranci.czytanie")
{
CultureInfo k = new CultureInfo("pl-PL");
DateTime dt = doc.GetDateTimeValue("Data", DateTimeHelper.ZERO_TIME);
dt = CMS.Globalization.TimeZoneHelper.ConvertToSiteDateTime(dt, CMS.SiteProvider.SiteContext.CurrentSite);
string tytul = dt.ToString("dd MMMM", k).TrimStart('0');
tytul += " - " + doc.GetValue<string>("Rok", "Rok A");
e.Node.SetValue("Tytul", tytul);
e.Node.DocumentName = tytul;
e.Node.NodeAlias = tytul;
}
}
}
}