回复评论

Package Action Samples

I got this from CodePlex, it was created by Richard Soeteman and various other people and can be found on CodePlex here - Personally I can't beleive this isn't in the WIKI as its GOLD information, and I only found out about it from a blog reply!

Also with in this is a GREAT peice of information is this cool package that lets you TEST your actions are correct

------

 

This document describes all Package Actions available in the Package actions project. The Package actions contrib. project can be found on http://packageactioncontrib.codeplex.com/ . A detailed document how to use Package Actions can be found on http://umbraco.tv/assets/package actions.pdf

Changelog

1.0.3 – First Release of the documentation

Thanks

First I want to thank the following persons for submitting their Package Actions to the project:

 Immo Wache for the actions AddHttpHandler, AddHttpModule, AddTreeNodeType and the Package Actions tester tool

 Warren Buckley, Peter Dijksterhuis and Aaron aka Slace for the SetCSSforRichTextEditor action

 Paul Sterling for the AddAppConfigKey action

 Harald Ulriksen for adding the UpdateNodeIdProperty action

Add a AppSetting to the web.config file

This Package action will Add a configuration key to AppSettings Section of the web.config file. The undo option makes sure that the key can be removed again at uninstall.

Alias: AddAppConfigKey

<Action runat="install" undo="true/false" alias="AddAppConfigKey" key="your key" value="your value" />

Add a HttpHandler

This Package action will add a HttpHandler to the HttpHandlers Section of the web.config file. The undo option makes sure that the handler can be removed again at uninstall.

Alias: AddHttpHandler

<Action runat="install" undo="true/false" alias="AddHttpHandler" position="beginning/end" path="umbraco/channels.aspx" verb="*" type="umbraco.presentation.channels.api, umbraco" validate="True/False" />

Add a HttpModule

This Package action will Add a HttpModule to the httpModules Section of the web.config file. The undo option makes sure that the module can be removed again at uninstall.

Alias: AddHttpModule 

<Action runat="install" undo="true/false" alias="AddHttpModule" position="beginning/end" name="TimingModule" type="Timer, TimingModule" />

Add a scheduled task

This Package action will Add a scheduled task to the scheduled tasks Section of the umbracosettings.config file. The undo option makes sure that the scheduled task can be removed again at uninstall. The url that you specify for the scheduled task can be either absolute or relative.

Alias: AddScheduledTask

<Action runat="install" undo="true/false" alias="AddScheduledTask" scheduledTaskAlias="myscheduledtask" log="true" interval="60" url="/myscheduledpage.aspx" />

Add application tree node type

This Package action will add a new nodeType to the UI.xml file for additional TreeNode tasks of Umbraco backend trees. You can use it to add a treeNode Type rule during install. You can add more than one treeNode type by adding two or more nodes into nodevalue. The undo option true makes sure that the treeNode Type will be removed at uninstall.

Alias: AddTreeNodeType 

<Action runat="install" undo="true/false" alias="AddTreeNodeType"> <nodeType alias="initrss"> <header>RSS Feed</header> <usercontrol>/create/simple.ascx</usercontrol> <tasks> <create assembly="tswe.rss" type="rssCreateTasks" /> </tasks> </nodeType> <nodeType alias="rssInstance"> <header>RSS Feed</header> <usercontrol>/create/simple.ascx</usercontrol> <tasks> <delete assembly="tswe.rss" type="rssCreateTasks" /> </tasks> </nodeType> </Action>

Add an Url Rewrite rule

This Package action will Add a new url rewriting rule to the UrlRewriting.config file. The undo option makes sure that the rewriting rule can be removed again at uninstall.

Alias: AddUrlRewriteRule 

<Action runat="install" undo="true/false" alias="AddUrlRewriteRule"> <add name="CWS_emaiAFriendID" virtualUrl="^~/email-a-friend/(.[0-9]*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/email-a-friend.aspx?nodeID=$1" ignoreCase="true" />

Allow template for a documentype

This Package action will add a template as allowed template for a documenttype. Both are referenced by their aliases. The undo option makes sure that the template can be removed from the documenttype again at uninstall. Alias: AllowTemplateForDoctype 

<Action runat="install" undo="true/false" alias="AllowTemplateForDoctype" documentTypeAlias="RunwayTextpage" templateAlias="RunwayHomepage" />

Execute an sql statement/script

This Package action will execute the specified sql statements or script during install..

Alias: ExecuteSql 

<Action runat="install" undo="false" alias="ExecuteSql"> <![CDATA[CREATE TABLE tmp ( [ClientCategoryId] [int] IDENTITY(1,1) NOT NULL)]]> </Action>

Set a CSS Style for the Richtext editor

This Package action will update a RichTextEditor dataType with an associated CSS file

Alias: SetCSSforRichTextEditor 

<Action runat="install" undo="true/false" alias="SetCSSforRichTextEditor" dataTypeName="yourDataTypeName" cssName="yourCSSName" />

Update NodeId Property

This Package action will update a property on a page with the node id of a child page.. Can be used for redirects after sending email or similar.

Alias: UpdateNodeIdProperty

<Action runat="install" undo="true/false" alias="UpdateNodeIdProperty"><UpdateNodeIdProperty onDocumentType="Contact" onDocumentName="" propertyName="redirectTo" fromDocumentType="Textpage" fromDocumentName="Thank you"> </Action>

 原文链接:http://our.umbraco.org/wiki/how-tos/packages-and-projects/package-action-samples

回复