Hi,
The medium term solution is also the short term solution. What you have to do is to create a new class that implements IPackageAction
In the execute method put the code to add the allowed action.
Code:
public class MyGreatInstallerAction : IPackageAction
{
/// <summary>
/// Install something
/// </summary>
public bool Execute(string packageName, XmlNode xmlData)
{
//Add new allowed document type documentType.AllowedTemplates.add .......
return true; //Succeeded
}
/// <summary>
/// UnInstall Something
/// </summary>
public bool Undo(string packageName, XmlNode xmlData)
{
return true; //Succeeded
}
/// <summary>
/// PackageAction Alias
/// </summary>
/// <returns></returns>
public string Alias()
{
return "MyGreatInstallerAction ";
}
/// <summary>
/// SampleXML
/// </summary>
/// <returns></returns>
public XmlNode SampleXml()
{
string sample = "<Action runat=\"install\" undo=\"true/false\" alias=\"MyGreatInstallerAction \"/>";
return helper.parseStringToXmlNode(sample);
}
}
When you create the package you must include the DLL that contains this class, it will be picked up automatically. Then you go to the Package Action section and you include this xml
Code:<Action runat="install" undo="true" alias="MyGreatInstallerAction " />
Make sure that the alias in the xml matches the alias from the Class. Otherwise umbraco will not execute this Package Action
This is the sort term solution. The long term solution would be to have some attributes on the xml node that describe which template alias or whatever must be added to a document type.
Hope this helps.
Richard
level 2 certified - Umbraco development -
Soeteman SoftwareImport data into Umbraco? Consider using
UmbImport