Nibble

Archive for April, 2009

Installing Umbraco Packages 2

I recently got a comment from a person that downloaded a package but didn’t know what steps to take to installing it.
So here is a small how to.

After you have successfully logged into umbraco go to the developer section (section menu is on the bottom left, if you don’t see the developer icon you don’t have permission to view that section).

installingpackages1

Then expand the Packages tree

installingpackages2

Since we’ll install a local (downloaded) package select ‘Install local package’, the install local package page will load.

installingpackages3

Then just choose the package from your machine and hit the load package button (it won’t be installed yet) .

Now (if it’s a valid package) you’ll see the next step. Here you’ll need to accept the license and hit the install package button

installingpackages4

If the package contains a custom usercontrol with some custom installation steps that will be loaded next (like in this case with the datefolder package).

installingpackages5

Once these custom steps have been completed (if there are any) the package should be installed.

You should now be able to view the installed package in the ‘installed packages part’ of the packages tree.

installingpackages7

There you’ll also be able to uninstall the package.

New Package - Related Media 10

Based on the related links datatype that’s been added to umbraco v4.

This is a similar datatype but for selecting media, so a multiple media picker.

relatedmedia

You can add media by setting a caption and selecting a media item. Very similar to the related links.

The package will also install a xslt and marco that shows how to use xslt to display the stored media.

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE xsl:stylesheet [
  &lt;!ENTITY nbsp “&#x00A0;”>
]>
<xsl:stylesheet
    version=”1.0″
    xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”
    xmlns:msxml=”urn:schemas-microsoft-com:xslt”
    xmlns:umbraco.library=”urn:umbraco.library”
    exclude-result-prefixes=”msxml umbraco.library”>
 
 
  <xsl:output method=”xml” omit-xml-declaration=”yes” />
 
  <xsl:param name=”currentPage”/>
  
  <!– Input the related links property alias here –>
  <xsl:variable name=”propertyAlias” select=”string(’relatedmedia’)”/>
  
  <xsl:template match=”/”>
 
    <!– The fun starts here –>
    <ul>
      <xsl:for-each select=”$currentPage/data [@alias = $propertyAlias]/media/item”>
        <li>
          <xsl:element name=”a”>
                <xsl:attribute name=”href”>
                  <xsl:value-of select=”umbraco.library:GetMedia(./@id,’false’)/data [@alias = ‘umbracoFile’]”/>
                </xsl:attribute>
            <xsl:value-of select=”./@title”/>
          </xsl:element>
        </li>
      </xsl:for-each>
    </ul>
 
  </xsl:template>
 
</xsl:stylesheet>

 

Related Media Package: download

New Package - Mail Engine 71

This is a first version of a new mailer for umbraco v4. It’s similar to the ultrasimplemailer but one main difference is that it isn’t a datatype but it’s a new item in the context menu. Since it needs rendertemplate support it’s only possible to use it with v4.0.1 and upper versions.

 

Intro

After Installation you’ll have a new item in the context menu: send as mail.

contextmenumailer

Hitting this option will open a new modal. Where you’ll be able to send a published document as a mail.

mailer1

The document needs to be published because the mail contents will be fetched from the rendered document output. Trying this on an un-published document will result in an error message.

mailer2

In the first step you’ll need to supply:

  • From emailaddress
  • From display name
  • Subject (this will be the document name but can be chanched)

 

mailer3

And choose to send it to a single email address or to multiple (mass option).

When sending a single mail you’ll just need to supply an email address. If a member is found with that email address his data will be merged (more about the merging below).

mailer4

Choosing the mass option will allow to select a membergroup and to supply a filter.

For example if you have a property on your membertype with the alias unsubscribe of the type true/false and you only want to send to members that don’t have this set to true.

You can supply the filter

unsubscribe@,0

mailer5

Once everything is set it’s just a matter of hitting the send button and you’ll see the progress in the status part.

 

Merging member data

It’s possible to merge member data. If one of these are found then they will be replaced

  • [memberId]
  • [memberName]
  • [memberLoginName]
  • [memberPassword]
  • [memberEmail]

Custom properties are also possible

  • [custompropertyalias]

So something like

Hi [memberName],

Your password is: [memberPassword]

Will be recieved by the member as

Hi John,

Your password is: 1234

 

Images

Another detail is that if there are images they will be added as a linked resource.

 

Extra

The package will also add an xslt extension, making it possible to send a rendered page directly to an email address or a member from xslt (with merging of data).

And it’s also possible to use the methods from .net.

A quick example:

I have setup a forgot password page that looks like this when previewed:

mailpassword

And I would like to use the asp.net PasswordRecovery control to send this mail instead of the regular passwordrecovery mail.

So all I need to do is override the PasswordRecovery mail using the SendingMail event.

 protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
        {
            Library.SendMailFromPageToMember(“test@nibble.be”,
                Member.GetMemberFromLoginName(PasswordRecovery1.UserName),
                “Password recovery Mail”,
                1056);
 
            e.Cancel = true;
 
        }

And call the SendMailFromPageToMember method, supply a from email address, the member (using umbraco.cms.businesslogic.member)  , the subject and the id of the page.

The result:

mailer6

Mail Engine Package download