Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Modify web part common properties View modes: 
User avatar
Certified Developer 13
Certified Developer 13
hutnyk.roman-gmail - 4/18/2012 3:41:28 AM
   
Modify web part common properties
Hi,

I want to add some properties for all web parts. Also i need to show them in the web part properties dialog, but unfortunately i can't find right approach. I've already modified every WebPart_PropertiesBefore.xml file i found under \CMSModules\PortalEngine\UI\WebParts\Properties\ folder:

<field column="DisplayToPermissions" fieldcaption="Display to permissions" visible="true" columntype="text" fieldtype="usercontrol" allowempty="true" isPK="false" system="false" columnsize="1000" fielddescription="Allows to manage visibility based on ShawOnline user's permissions." publicfield="false" spellcheck="true" guid="190c38c7-904b-4044-bc78-6998b50ae31a">
<settings>
<controlname>rolecheckboxselector</controlname>
</settings>
</field>

So now i can see fields i added in system properties tab of web part under site manager, but still can't see them in web part properties dialog.

I'm using Kentico 6.
Any suggestions?

Thanks.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 4/18/2012 4:48:20 AM
   
RE:Modify web part common properties
Hello,


can you restart the application in Site manager -> Administration -> System?

I have tested a copy of Visible property:

<field column="Visible2" fieldcaption="Visible2" visible="true" defaultvalue="true" columntype="boolean" fieldtype="checkbox" allowempty="false" isPK="false" system="false" fielddescription="{$documentation.webpartproperties.visible$}2" publicfield="false" spellcheck="true" guid="8f751ce3-374f-4026-b935-2389d694a10d" />

and it worked correctly (I can see the property in the dialog). Can you test this code unless the restart helps?


Best regards,
Helena Grulichova

User avatar
Certified Developer 13
Certified Developer 13
hutnyk.roman-gmail - 4/18/2012 5:39:58 AM
   
RE:Modify web part common properties
Thanks Helena,

The issue was that i added custom field to a dialog, but there was not such public property inside of web part, so i added property to web part and field appeared.

Now i've tried to override web part base class - CMSAbstractWebPart and i want to manage web part visibility from that class, but i can't find appropriate event to hide it. Could you please help?

Thanks,
Roman Hutnyk

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 4/18/2012 5:54:30 AM
   
RE:Modify web part common properties
Hello,


I am not sure whether I understand.

You have the full source code and want to re-write the value of the Visible property for all web part?

Or you want to access the Visible property from within a web part?

You can also add a macro to the Visible property to manage a web part's visibility.

Thank you in advance for a detailed explanation of your scenario.


Best regards,
Helena Grulichova

User avatar
Certified Developer 13
Certified Developer 13
hutnyk.roman-gmail - 4/18/2012 6:38:42 AM
   
RE:Modify web part common properties
Helena,

first of all i do not have full source code, so that's why i'm going to override CMSAbstractWebPart class and inherit needed web parts from my custom class.

As you know i've already added custom field for web part properties dialog and that custom field will be available only for web parts inherited from my custom class CMSAbstractWebPartExtended.

The idea is to manage web part visibility similar to "Show to roles", but due to project specific there are additional conditions.

I've already overridden Visible property inside of CMSAbstractWebPartExtended and it works fine.

The next stem i need to implement is to add something similar for CMS Document (page, articte, news...): it means that, for example, i need to show/hide page in the navigation based on additional conditions. Any thoughts?

Thanks for your support.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 4/19/2012 5:26:56 AM
   
RE:Modify web part common properties
Hello,


You can add a value to the document or node like this: Custom document data.

Then you can use the value for the Where condition of Menu.


Best regards,
Helena Grulichova