How can I override 'base_edit' view for a type using portal_factory? - plone

It seems that when I use the portal_factory tool for creating an instance of a type it disregards the view I've specified to override base_edit.
Here's what I've got setup:
Alias from edit to base_edit in the types tool.
View class that renders the view.
ZCML that that hooks on the view class to the appropriate interface.
Content class that implements the appropriate interface.
I know my overridden base_edit view works because it renders:
Once the object has been created it renders.
When I disable the portal_factory tool for the type.
When I use another name like custom_edit it also renders the overridden view, despite the type being enabled in the portal_factory tool.

Changing the alias to ##base_edit works too.
this way zope traversing makes an adapter lookup instead of attribute access and your edit view will be used.
afaik the ## forces an adapter lookup, without ## the first object thru acquisition is called and then an adapter
cc #juriejan

You don't need to customized the base_edit.cpt, you simply need to create a new CMF skin template called yourtypenamenormalized_edit.pt, where "yourtypenamenormalized" is your portal_type name lowercase and without spaces.
The original Archetype base_edit.cpt will look for a template called this way before applying all default macros.
After that I suggest you to fill this new template with all the code you'll find inside the default template, that is edit_macro.pt, then start to apply your changes.
Commonly the only macro you'll want to override is the body macro.

Related

How to get gwt widget default stylename

In gwt how to get a widget's default style(CSS Selector).For example, gwt button has style name "gwt-button" which is referenced in gwt theme css file.
How to got that programmatically.
Is there any,
DOM.getStyleAttribute();
to accomplish this. GWT experts please help.
In your example of button (or any object that is a child of UIObject) can call getStyleName()
UIObject documentation
String com.google.gwt.user.client.ui.UIObject.getStyleName()
Gets all of the object's style names, as a space-separated list. If you wish to retrieve only the primary style name, call getStylePrimaryName().
Now as to why you need this information is the real question. It is my guess that you want to change the styling of an object (add or remove). This would best be done by either of the following methods.
1) Supplying a custom resources file to the object that has your styling
2) creating a class that extends Composite and create a custom UIBinder class with all of your styles within it.

Informing RactiveJS about new object properties in magic mode

I'm new to Ractive.js and using "magic mode" so that updates to my JS objects automatically trigger updates to my UI. Everything is working great except that I have some properties which are added to my bound objects after my Ractive instances are rendered. This means that Ractive doesn't see changes to those properties, so the "magic" doesn't work for them.
As a workaround, I've found that I can just initialize those properties with 'empty' values before passing them to Ractive, but it feels a little unnatural.
Is there a preferred way to inform Ractive that I've added a new property to an object that it should start tracking?
My experince is that you can du that in 2 ways.
The first is the one you describe in your post.
The second is to "add" the property through the template that you use to render the object.
What ractive actually do when you set magic mode to true is "wrapping/replacing" your field with a property wich monitores the changes to the field.
I have had som issues using magicmode when i use Object.DefineProperty on my data objcect. (stuff get called twice)
I would go for soulution 1, and define all fields ahead of time.
Also be aware of setting your field(wich is actually now a property replaced by ractive) to something that is not a valuetype as that will again overwrite the property and mess up magicmode.

In a tabpage GUI Extension, what does the ext:pagetype node do?

I have a GUI Extension adding a Tab (ext:tabpage) to View.
What does the ext:pagetype node do? I have been using Namespace:Name like the following. Are there other options for the value?
<ext:pagetype>RC.TabExtension</ext:pagetype>
It allows you to have a specific JavaScript implementation for that tab.
If you specify the full name of a JavaScript class and it implements the Tridion.Controls.DeckPage interface, it will use that implementation for the tab.
If it's not a class or it doesn't implement the interface, it will just use the default implementation.
(Tabs inherit from Decks, in case you are wondering)

Change WF4 ActivityDesigner theme

I want to change my rehosted activities look to:
Already tried ActivityDesignerTheme
Need to do it without using WorkflowViewElement because I don't want to lose it's behaviors (breakpoint, expanding).
If it's not possible, is there a way to change ActivityDesigner header background color?
#Will
I was annoyed too by the default behavior of the ActivityDesigner header when editing the DisplayName (especially the part where it positions the caret at the beginning of the string). I used Reflector to peek (System.Activities.Presentation.dll) at the implementation and I noticed that some of this behavior is defined in OnApplyTemplate. By just overriding this method in my custom designer class and NOT calling base.OnApplyTemplate(), I was able to make the DisplayName read only in the header (in my case that was all I needed, but I think one can play with some custom event handlers in there and tweak the behavior).
#Davi Fiamenghi
Digging around some more with Reflector in the same assembly, I found the controls used in OnApplyTemplate defined under system/activities/presentation/workflowelementdesignerdefaulttemplate.baml (System.Activities.Presentation.g.resources). That seems to be the default control template used for ActivityDesigner (<ControlTemplate x:Key="WorkflowElementDesignerDefaultTemplate" x:Uid="ControlTemplate_1" ControlTemplate.TargetType="{x:Type swd:ActivityDesigner}">). I guess one way to change the header color would be to try to "re-create" this template in your application and set it explicitly in your custom activity designer. Of course it's more involved than just copying it, since it appears to be referencing other resources defined in that assembly.
Hope this helps.

How to specify in QTP's Object Repository, that I want to find Web Button object by title

I have rich web application with a lot of dynamic stuff (used ExtJS 3.0). I want to find Web Button using HP QuickTest Pro 10. This web button have only one property , that can uniquely identify it: title. But if I define that object in Object Repository with Description Property Title= it doesn't find it.
Please, advise me what can I do in that situation? I've tried to use object.title=Some value as well, but it doesn't helped.
Thanks!
Title is a DOM property not a QTP property, you can use DOM properties for identification by appending attribute/ to the property name.
Try adding a new property "attribute/title" to the button class, and make that an identification property in the object identification configuration.
The "attribute/" prefix allows you to use any attribute that you can access via the Object property.

Resources