How can I extend/configure other plone addons preferences Configlets? - interface

I have a third-party addon installed and now I have to extend this Configlet with a boolean Field, how can I do this?
Further I have to use results of a function from this addon?
Thanks in advance.

You can either try
1) Override form via a custom layer registered by your add-on and create new Form class, extending the orignal, which has the same name, but is registered against this layer. Thus, the form class will come from your add-on when your add-on and it's browserlayer is installed.
http://collective-docs.readthedocs.org/en/latest/views/layers.html
Layers are view-specific, so it is the view you are trying to override. Depending on the orignal c.simplesocial architecture it is not sure what kind of view - form relationship is in place.
2) monkey-patch the orignal form class
http://collective-docs.readthedocs.org/en/latest/misc/monkeypatch.html

Related

How to distinguish wizards in Eclipse RCP?

We have an Eclipse IDE application on 3.x that uses various newWizards to allow the user to create different files. Although these files differ slightly contentwise, the structure of the wizards is quite similar.
Thus, a sound object-oriented approach would be to instantiate different wizards from the same class and initialize them with different data.
Problem:
To decide what wizard needs which data we need a way to distinguish the different already instantiated wizards (e.g during the call to the init method of the wizard).
Is there any way to do so? It would e.g. help if somebody knows a way to get the wizard's id defined in the extension point from within the instantiated wizard.
If your wizard implements IExecutableExtension, it will be passed the configuration element that represents the extension for which it is created.
You can also use extension factories in that you specify a type that implements IExecutableExtensionFactory.
The interface allows you to control how the instances provided to extension-points (wizards in your case) are created.
Extension example:
<extension point="org.eclipse.ui.wizards">
<newWizard
name="..."
class="com.example.WizardFactory">
</newWizard>
Note that the extension factory may also implement IExecutableExtension to gain access to extension attributes before creating the extension's executable class.

How to add short description in ATG Component?

How to add short description for component property in ATG.
Ex: If we see loggingDebug property in a Nucleus componenet Short description will shown as True if debug log events should be generated. How to create such description for my property in component>
Simple Answer:
You cannot add a description for an individual property.
You can add a description for a component by specifying a $description in the .properties file
More Complex Answer:
For viewing in the dyn/admin screens, each Nucleus component is associated with an Admin Servlet. It is the Admin Servlet of the component that renders the admin screen (not a JSP or JHTML page).
For a given component, the admin interface determines the admin servlet to use for rendering the screen by querying the component.
ATG packages a number of admin servlets with the platform. The default one is ServiceAdminServlet and is associated with the GenericService. So anything that extends from GenericService - most of the components you write - gets an admin screen that is rendered by ServiceAdminServlet. There is a different one for the Repository class - which is why the admin screen for a repository component looks different to that for most other components.
You can implement your own admin interface for your components by implementing your own AdminServlet class, and overwriting the getAdminService() method (defined in the AdminableService interface) on your component to return an instance of your custom admin servlet.
However, GenericService already implements the interface, and provides a convenient extensible hook method createAdminServlet(), and it is preferable to extend ServiceAdminServlet than creating your own AdminServlet from scratch.
The ServiceAdminServlet class defines a printAdmin(...) method which you override to output the custom HTML needed.
Caveat:
In my original answer, I had missed out the More Complex section, because I think that it is far more effort for little gain. However, I have updated my answer to be more complete.
I have been working, very hands-on, with the ATG platform since 1998, and never once have I had reason to create my own admin interface.
I think what you need is create the MyComponentBeanInfo.java.
if you look inside the ATG_PATH\DAS\src\Java\atg\droplet, will see something like this: Component.java and your descriptor ComponentBeanInfo.java.
i have searched in oracle docs and i found this link:Oracle Docs: BeanInfo Example
inside in your componente will be:
paramDescriptors[0] = new ParamDescriptor("myProperty",
"this is my short description",
DynamoServlet.class,
false, true, outputDescriptors);
beanDescriptor = new BeanDescriptor(MyComponent.class);
beanDescriptor.setShortDescription("A custom servlet bean.");
beanDescriptor.setValue("paramDescriptors", paramDescriptors);
beanDescriptor.setValue("componentCategory", "Servlet Beans");

Joomla! 2.5+: Abuse a system plugin to create an URI addressable view

As it is fairly simple to create frontend views into the content area using Joomla!'s component infrastructure and a menu item, I wonder if it is not possible to abuse a system plugin to achive the same goal. Reason: keep the code slim (A plugin can consist only of two files.)
Suppose having mydomain.com/myuri, the system plugin should catch myuri, than override the content by a special content using onAfterRender.
My approach is to set some class variable within the derived plugin class to true, if the URI was hit. How can this be done, and which onEvent should be used?

IoC, MVC4 Web API & HttpParameterBinding/ParameterBindingAttribute

I'm using ASP.Net MVC 4 RTM Web API. I have a controller action with a parameter that I'd like to populate via custom model binding. To achieve this, I created a class that derives from System.Web.Http.Controllers.HttpParameterBinding that sets the value of this parameter. I then created an attribute class that derives from System.Web.Http.ParameterBindingAttribute which I use to decorate the parameter on my controller action.
This is all working great, my HttpParameterBinding class is populating the action parameter correctly. The problem I have is that my custom parameter binding class has a dependency that I'd like resolved via my IoC container (Unity). Is there a way to override how Web API creates HttpParameterBinding instances so that I can build up my custom binding class dependency from Unity? I was able to do something similar for a filter attribute by creating a custom filter provider that uses Unity's BuildUp method to populate dependencies, however I'm not seeing anything similar for Web API's HttpParameterBindings.
In general: to use IoC / Unity in the Web API you need to set it up seperately.
Try downloading the nuget package Unity.WebApi and see if that helps!
Take a look at this article: Parameter Binding in WebAPI
It walks through a couple different options from Converters to Binders to BinderProviders. It sounds like you may be able to write a custom ModelBinderProvider which knows how to provide your dependency. If that isn't high enough in the chain you can look at replacing the default IActionValueBinder service. It's a DefaultActionValueBinder instance, which you can extend or simply re-implement.
I also highly recommend downloading the WebAPI source code, as it's been an incredible help for these issues as I've run into them. Here's the WebAPI source code. I recommend downloading it so you can open it in VS for easy navigation.
Feel free to check out FlitBit too (It's very modular, don't let the number of packages scare you off)! I'm working on a WebAPI package for supporting FlitBit, specifically FlitBit.IoC and FlitBit.Dto. I'll add an update if I work out my IoC issue, since it's very similar to yours.

Zend Framework Plugins

Kindly explain the following regarding Zend Framework and how do I know which one to use, and when and where to use them.
resources.layout.pluginClass
resources.frontcontroller.plugins
The first is described on this page and allows you to provide a specific layout controller plugin class to override the default
pluginClass: the front controller plugin class to use when using Zend_Layout with the MVC components. By default, this is Zend_Layout_Controller_Plugin_Layout
The second, described here allows you to register any number of generic controller plugins
plugins: array of front controller plugin class names. The resource will instantiate each class (with no constructor arguments) and then register the instance with the front controller. If you want to register a plugin with a particular stack index, you need to provide an array with two keys class and stackIndex.