Anders Hattestad
Apr 26, 2010
  10309
(0 votes)

Itera.MultiProperty and CMS 6

I tried to take the current Itera.MultiProperty project and recompile it with the CMS 6. It compiled without errors. But when you use it it throws and error complains about Multiple custom attributes of the same type found

The error is caused by some of the properties that are tagged with a

[GuiPlugIn(SortIndex = 70,DisplayName="Sort")]
public class PropertyFilterSort : PropertySortOrder, IHavePageCollectionFilter
{

and PropertySortOrder are tagged with

[Serializable, PageDefinitionTypePlugIn]
public class PropertyFileSortOrder : PropertyNumber
{

 
The old CMS 5 public static PlugInDescriptor Load(Type plugin) get the attributes with this line
descriptor = Load(plugin.ToString(), 
plugin.Assembly.GetName().Name);
but the new CMS 6 public static PlugInDescriptor Load(Type plugin) starts to get the attribute with this line:
customAttribute = Attribute.GetCustomAttribute(
plugin,
typeof(PlugInAttribute)
) as PlugInAttribute;

Since GuiPlugIn and PageDefinitionTypePlugIn inherits from PlugInAttributes the latest get two attributes….

The quick fix is to remove

List/Filters/PropertyFilterSort.cs

and remove PageDefinitionTypePlugIn from List/PropertyIteraPagesSelector.cs

from the project and recompile.

 

The problem is of course that old code depending on that it’s possible to have 2 different plugin attributes will not work.

Apr 26, 2010

Comments

Sep 21, 2010 10:33 AM

And the full code is

CMS6:
public static PlugInDescriptor Load(Type plugin)
{
PlugInDescriptor descriptor;
if (plugin.Namespace == "ASP")
{
descriptor = new PlugInDescriptor(-1, plugin.ToString(), plugin.Assembly.GetName().Name, true);
descriptor.IsAutoGenerated = true;
return descriptor;
}
string key = "PlugInDescriptor." + plugin.FullName;
descriptor = CacheManager.Get(key) as PlugInDescriptor;
if (descriptor == null)
{
PlugInAttribute customAttribute = Attribute.GetCustomAttribute(plugin, typeof(PlugInAttribute)) as PlugInAttribute;
if (customAttribute != null)
{
descriptor = Load(plugin.ToString(), plugin.Assembly.GetName().Name, customAttribute.DefaultEnabled);
}
else
{
descriptor = Load(plugin.ToString(), plugin.Assembly.GetName().Name);
}
CacheManager.Add(key, descriptor);
}
return descriptor;
}




CMS 5:
public static PlugInDescriptor Load(Type plugin)
{
PlugInDescriptor descriptor;
if (plugin.Namespace == "ASP")
{
descriptor = new PlugInDescriptor(-1, plugin.ToString(), plugin.Assembly.GetName().Name, true);
descriptor.IsAutoGenerated = true;
return descriptor;
}
string key = "PlugInDescriptor." + plugin.FullName;
descriptor = CacheManager.Get(key) as PlugInDescriptor;
if (descriptor == null)
{
descriptor = Load(plugin.ToString(), plugin.Assembly.GetName().Name);
CacheManager.Add(key, descriptor);
}
return descriptor;
}
/ Anders Hattestad

Sep 21, 2010 10:33 AM

added and remove PageDefinitionTypePlugIn from List/PropertyIteraPagesSelector.cs
/ Anders Hattestad

Sep 21, 2010 10:33 AM

Have registered this as an bug
/ Anders Hattestad

Juan Londono
Juan Londono Aug 15, 2011 05:58 PM

Hi Anders.
The Itera.multiproperty is throwing and warning message on a PropertyMulitBase when adding multiple items:
"are you sure you want to navigate from this page?"

I added the following code to the method PropertyMulitBaseControl.AddButton(...)

Button add = new Button();
ScriptManager current = ScriptManager.Current;
if (current != null)
current.AddEventListener(add, new DisablePageLeaveEvent(EventType.Submit | EventType.Click));

with no success. Can you advice please?
Thanks

Patrick Heneghan
Patrick Heneghan Sep 19, 2011 02:44 PM

Hi Anders,

We are having a problem with the MultiProperty project, similar to Ticket #160 (assigned defect) on epicode.

On a particular page type, we have a MultiProperty with about 4 properties inside it, as well as two properties using the TinyMCE editor. We can add up to 4 instances of the MultiProperty without any problem.

However, when we add a 5th instance, the TinyMCE editors will disappear (except for the words 'Paragraph' and 'Styles')

Deleting the 5th instance results in the TinyMCE editor being displayed correctly once again.

This only happens in IE (8) but not in Firefox.

Do you have any idea how to fix this?

Nov 15, 2011 02:00 PM

Hi Anders
I also have some problems with MultiProperty and CMS 6. In the editor when clicking save, the property is not saved. It works fine using "Save and View" or "Save and Publish" but when I click save the page is reloaded, the property is also displayed but without values. Any ideas?

steven pap
steven pap Mar 8, 2012 12:08 PM

thanks guys. that helped me out a lot..

Jan 31, 2013 02:14 PM

I have the same problem as Kristina. It only happens when you're logged in with a non-admin account. Found any solution?

Please login to comment.
Latest blogs
Opti ID overview

Opti ID allows you to log in once and switch between Optimizely products using Okta, Entra ID, or a local account. You can also manage all your use...

K Khan | Jul 26, 2024

Getting Started with Optimizely SaaS using Next.js Starter App - Extend a component - Part 3

This is the final part of our Optimizely SaaS CMS proof-of-concept (POC) blog series. In this post, we'll dive into extending a component within th...

Raghavendra Murthy | Jul 23, 2024 | Syndicated blog

Optimizely Graph – Faceting with Geta Categories

Overview As Optimizely Graph (and Content Cloud SaaS) makes its global debut, it is known that there are going to be some bugs and quirks. One of t...

Eric Markson | Jul 22, 2024 | Syndicated blog

Integration Bynder (DAM) with Optimizely

Bynder is a comprehensive digital asset management (DAM) platform that enables businesses to efficiently manage, store, organize, and share their...

Sanjay Kumar | Jul 22, 2024

Frontend Hosting for SaaS CMS Solutions

Introduction Now that CMS SaaS Core has gone into general availability, it is a good time to start discussing where to host the head. SaaS Core is...

Minesh Shah (Netcel) | Jul 20, 2024

Optimizely London Dev Meetup 11th July 2024

On 11th July 2024 in London Niteco and Netcel along with Optimizely ran the London Developer meetup. There was an great agenda of talks that we put...

Scott Reed | Jul 19, 2024