Lee Crowe
Jul 27, 2011
  10924
(8 votes)

Introducing Page Type Builder UI

Back in November 2010 Erik Nordin released his PropertyMatch.aspx admin plug-in for PageTypeBuilder see the article here.

This little tool has been invaluable for anybody using PageTypeBuilder on large EPiServer builds.  It points out discrepancies between PageTypeBuilder page type properties and EPiServer page type definitions and allows you to edit or remove them.

For the last few weeks I have been helping Joel Abrahamsson out adding various features to the up and coming version of PageTypeBuilder.

Over the last week I have had a bit of unoccupied train commuting time so I decided to revisit the plug-in that Erik originally created and extend it a little as there were a few things I thought were missing.

Note to Erik: Sorry Erik, I’m not trying to steal your thunder here but thought the new additions described below are very useful and for the greater good of the community Winking smile.

Installation

To install the plug-in you will need to download the relevant version of the PageTypeBuilderUI.dll from codeplex and add it to your EPiServer CMS 6 projects bin folder.

The version numbers of the releases are currently inline with the relevant version of PageTypeBuilder they are built against.

Current versions are:

  • v1.3
  • v1.3.1
  • v1.9.1 (PageTypeBuilder v2 Preview 1)
  • v1.9.2 (PageTypeBuilder v2 Preview 2)

You will also need to add the following folder to your web app /Templates/Plugins/Admin.

You may well be wondering why the project is named PageTypeBuilderUI rather than PageTypeBuilder.UI? This is because in time this project may be integrated into PageTypeBuilder v2+ so we wouldn’t want naming conflicts Smile


Please note
: The plugin is built to work with EPiServer CMS 6 R1 and upwards and PTB v1.3 and upwards.

It is advised you lock the plug-in down to WebAdmins and Administrators.  To do this you can add the following to your web.config:

 

  1: <location path="Templates/Plugins/Admin">
  2:     <system.web>
  3:       <authorization>
  4:         <allow roles="WebAdmins, Administrators"/>
  5:         <deny users="*"/>
  6:       </authorization>
  7:     </system.web>
  8:   </location>


New Features

  1. Updating of property types
    I believe Erik had previously mentioned that he would like to add this functionality assuming he got time but probably never got around to it.

    If there are discrepancies between the EPiServer page definition type and the PageTypeBuilder page type property type then a checkbox will be displayed which can be checked to indicate that you would like the type to be updated.  When the ‘Update Property Types’ button is clicked the page definitions will be updated with the PageTypeBuilder Page Type property type.  A suitable warning about potential loss of data will be displayed first.

    When updating property types, if a default value has been specified that is not valid for the new type a suitable error message will be displayed and the property will not be updated.  This is inline with the validation which is performed in EditPageTypeField.aspx
  2. Bulk removal of properties
    If there are any properties to be removed you can select all relevant page definitions by either checking the ‘Remove’ check boxes individually or toggling the select all check box.  Upon clicking the ‘Remove Properties’ button all selected page definitions will be deleted.
  3. Bulk update of property types
    If there are any properties that need there property types updating you can select all the relevant page definitions by either checking the ‘Update Type’ check boxes individually or toggling the select all check box.  Upon clicking the ‘Update Property Types’ button all selected page definitions will have there types updated.
  4. If ‘Show only miss-matches is checked then only page types with mismatches will be shown

Below is a screen dump of the admin plug-in:


Globalizing the plug-in

The text displayed by the plug-in is taken from an embedded resource of the PageTypeBuilderUI.dll assembly.  If you would like to globalize the plug-in you can add the language settings found here into the relevant language file within your EPiServer site.

Future versions

When PageTypeBuilder v2.0 is officially released I will release PageTypeBuilderUI v2.0.

Feedback

Please feel free to email or twitter me with any feedback @croweman

Jul 27, 2011

Comments

Erik Nordin Wahlberg
Erik Nordin Wahlberg Jul 28, 2011 10:39 AM

Great work Lee! And you don't have to worry about me being offended. :)

Jul 28, 2011 10:52 AM

Thanks Erik :v)

For those of you unfortunate ones who have already downloaded the plug-in, I noticed a spelling mistake and had also placed the virtual page path within the /templates folder. This would mean you can not easily secure the page.

All of the available packages on codeplex have been updated to fix the spelling mistake and page path issue.

Sorry for any inconvenience.

Lee

tompipe
tompipe Aug 1, 2011 11:52 AM

Great work Lee. I too found the previous version always had a mismatch with XHTMLStrings and PropertyStrings (or something along those lines) and I had to manually update the type on the PTB class. Updating it was something on my to-do list, so you saved me a job!

(Edit: Just realised the mismatch with string types is in the CreatePTBClasses plugin, not the MatchPTBProperties discussed here! Ooops!)

One thing worth noting, I'd included the source as a project in one of our solutions, and was encountering the issue described in http://support.microsoft.com/kb/957661

I had to change the target framework on the project to .net 4, but it still complained that the /Templates/Plugins/Admin/ folder didn't exist. The quick fix is obviously to create the folder, (or change the plugin Url) but it might be worth considering overriding the GetDirectory method in the ResourcePathProvider to make this a fully contained 'drop and go' plugin.

Aug 2, 2011 06:04 PM

I forgot to test for the /Templates/Plugins/Admin folder not existing. That's what happens when you release things when you are half asleep :)

I will update at some point.

Ger Groot
Ger Groot Oct 12, 2011 10:54 AM

Hi Lee,

I hope you can help me, I keep getting this error when I try to open the page.

Directory 'C:\Users\gerg\Documents\Projects\_svn\_EpiServer\deploeg\branches\bugfixing\2.2\Indivirtual.DePloeg.Web\Templates\Plugins\Admin' does not exist. Failed to start monitoring file changes.

Is there something else that needs configuration?

Oct 12, 2011 11:06 AM

Hi Ger

The version of PageTypeBuilderUI you are using is dependent on the web application containing the following folder heirarch /Templates/Plugins/Admin.

This issue has been resolved in the latest version of PageTypeBuilderUI which can be downloaded from codeplex or the nuget episerver feed.

Lee

Ger Groot
Ger Groot Oct 12, 2011 11:35 AM

Too bad, still can't get it to work, even with the latest PageBuilderUI version (1.9.2) and the latest Episerver version (6.1.379.0).

Also tried it in the example site (Alloy Technologies), but there I get the same error!

Oct 12, 2011 11:36 AM

What version of PTB are you using? And also has the error changed? If you are using the latest version the plugin will be pulled from the /Util/ path and not /Templates/.

Ger Groot
Ger Groot Oct 12, 2011 12:56 PM

PTB version is 1.3.1.0. The error is still the same. I'm using the http://pagetypebuilderui.codeplex.com/releases/view/70719#DownloadId=263289 version.

Oct 12, 2011 12:58 PM

You will need PageTypeBuilderUI v1.3.1 for PTB v1.3.1. PageTypeBuilderUI v1.9.2 is for PTB v2 Preview 2.

Hope that helps?

Ger Groot
Ger Groot Oct 12, 2011 01:18 PM

Hi Lee, thanks but still no success. I've now tried PTB UI 1.3.1 but the same error keeps popping up.

Small piece of the stack trace:
[HttpException (0x80070003): Directory 'C:\Users\gerg\Documents\Projects\_svn\_EpiServer\deploeg\branches\bugfixing\2.2\Indivirtual.DePloeg.Web\Templates\Plugins\Admin' does not exist. Failed to start monitoring file changes.]
System.Web.FileChangesMonitor.FindDirectoryMonitor(String dir, Boolean addIfNotFound, Boolean throwOnError) +827
System.Web.FileChangesMonitor.StartMonitoringPath(String alias, FileChangeEventHandler callback, FileAttributesData& fad) +1063
System.Web.Caching.CacheDependency.Init(Boolean isPublic, String[] filenamesArg, String[] cachekeysArg, CacheDependency dependency, DateTime utcStart) +11559984
System.Web.Caching.CacheDependency..ctor(Int32 dummy, String[] filenames, DateTime utcStart) +63

Oct 12, 2011 01:32 PM

We will get there in the end. I have just checked the assembly on codeplex and it was still using /Templates directory rather than /util. The nuget package is up to date but codeplex wasn't but is now.

If you dry downloading again you should be sorted? Sorry for messing you around.

Ger Groot
Ger Groot Oct 12, 2011 01:47 PM

yes! It's working now. Thanks Lee.

Dec 22, 2011 02:29 PM

This one is kind of restrictive if you use another role provider than the one shipped with EPiServer (ex. AD or a custom)

if (!this.User.IsInRole("WebAdmins") && !this.User.IsInRole("Administrators"))
this.Response.Redirect("/", true);

Guess I have to download the source :D

Dec 22, 2011 02:31 PM

Yes it is, I did think about making the role configurable but never got round to doing it :(

Feb 18, 2013 03:23 PM

any chance of an EPiServer 7 port?

Please login to comment.
Latest blogs
Recraft's image generation with AI-Assistant for Optimizely

Recraft V3 model is outperforming all other models in the image generation space and we are happy to share: Recraft's new model is now available fo...

Luc Gosso (MVP) | Nov 8, 2024 | Syndicated blog

ExcludeDeleted(): Prevent Trashed Content from Appearing in Search Results

Introduction In Optimizely CMS, content that is moved to the trash can still appear in search results if it’s not explicitly excluded using the...

Ashish Rasal | Nov 7, 2024

CMS + CMP + Graph integration

We have just released a new package https://nuget.optimizely.com/package/?id=EPiServer.Cms.WelcomeIntegration.Graph which changes the way CMS fetch...

Bartosz Sekula | Nov 5, 2024

Block type selection doesn't work

Imagine you're trying to create a new block in a specific content area. You click the "Create" link, expecting to see a CMS modal with a list of...

Damian Smutek | Nov 4, 2024 | Syndicated blog

.NET 8 FAQ

I have previously written about .NET compatibility in general and .NET 8 in particular, see blog posts here , here and here . With the end of suppo...

Magnus Rahl | Nov 4, 2024

Dynamic packages in Commerce Connect

In Optimizely Commerce Connect, you can group different items using packages and bundles. Package: A package has one or more versions of a product...

K Khan | Nov 1, 2024