hi Grégory
My last entry in this thread. I created a fix for us, and want to show it to
you. Though sufficient for us it's probably not exactly how you guys would
like to do it, but at least it clarifies the problem.
cheers,
Ernst
2011/3/8 Grégory Joseph <[email protected]>
>
> Hey Ernst,
>
> Hmm.. we're not sure what the problem is. A few observations - see
> https://img.skitch.com/20110308-9nutwd52e2gk8i6an9jdw7fnm.jpg for
> reference.
> * Label of the "main" control can be changed. (red)
> * The "main" control currently can't have a description. I consider this a
> bug (blue)
> * The handler-specific label/description are indeed "shared" accross the
> controls (green, although this particular screenshot was made with a
> different handler selected in each control, thus NOT really demonstrating
> this valid point :-D)
>
> Just for the record, here's how we just tested this:
> https://img.skitch.com/20110308-mhy8rrr5a22wu6k7gaygxgr2xn.png
>
> Now - I'm supposing this isn't your problem. Can you clarify ?
>
> -g
>
> On 02 Mar 2011, at 16:58, Ernst Bunders wrote:
>
> > Hi all
> >
> > We use the openminds simple media module for all our sites, and we do
> this by means of the simple media dam integration.
> > This is all right, but one thing has been bothering me: All the controls
> show the same label and description in the dialog, no matter what you set in
> the dialog configuration.
> >
> > This is rather annoying, specially if you have dialogs with more than one
> image. For instance: we sometimes have headers with a background image, and
> a logo image, and those should be set in the page info dialog. So we have
> two dam controls both faithfully saying: "select image", which could be a
> bit confusing for site editors.
> >
> > Today I had some time, and decided to see why this is. So I first put a
> breakpoint at
> net.sourceforge.openutils.mgnlmedia.media.dialog.DialogSelectMedia#init and
> followed the call stack up.
> >
> > I found what i was looking for in
> info.magnolia.module.templatingkit.dam.dialog.DialogDAM#loadSubs where all
> the configured controls for the dam handler are instantiated and added as
> subs. The config node that is passed in our case is
> config:/modules/extended-templating-kit/config/sites/geschiedenis/damSupport/handlers/media/controls/MediaUUID
> >
> > The configuration that was injected into DialogDam#init is not used at
> all.
> >
> > What is slightly surprising to me is that you can register more than one
> control for a dam handler, especially since controls can have subs, so if
> you need more than one control for a specific handler, you can wrap it in a
> container control. A consequence of this architecture is that it is no
> longer logical to somehow merge the control config that was provided to the
> init method and the static control config from the dam handler
> configuration. Yet this is pretty much what i would expect.
> >
> > Until now I had considered this a bug, but now i see this is actually
> sane behavior, given the choice tho allow more than one control for dam
> handlers.
> >
> > I now feel inclined towards creating my own extension of DialogDam, and
> make the following changes:
> > - allow one control only
> > - merge the 'local' control configuration with the 'global' configuration
> using something like info.magnolia.cms.util.ExtendingContentWrapper
> >
> > I guess there are a few properties you don't want to override, like
> > - controlType
> > - type
> > -...
> >
> > I wonder what you guys at Magnolia think about this. It is a bit weird to
> show the same label and descripion on all dam controls. Do you feel it's a
> problem, and would you agree with my solution?
> >
> > regards,
> >
> > Ernst
> >
> >
> > --
> > Ernst Bunders
> > Ontwikkelaar VPRO
>
>
>
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------
>
>
--
Ernst Bunders
Ontwikkelaar VPRO
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------
package nl.vpro.magnolia.module.images.dam;
import info.magnolia.cms.core.Content;
import info.magnolia.cms.gui.dialog.DialogControlImpl;
import info.magnolia.cms.util.NodeDataUtil;
import info.magnolia.module.templatingkit.dam.dialog.DialogDAM;
import javax.jcr.RepositoryException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Created by IntelliJ IDEA.
* User: ernst
* Date: 3/11/11
* Time: 5:20 PM
* To change this template use File | Settings | File Templates.
*/
public class SingleHandlerDialogDam extends DialogDAM{
@Override
public void init(HttpServletRequest request, HttpServletResponse response, Content storageNode, Content configNode) throws RepositoryException {
super.init(request, response, storageNode, configNode);
//now we will set the label and the description of the config node on the first sub
Object o = getSubs().get(0);
if (DialogControlImpl.class.isAssignableFrom(o.getClass())) {
DialogControlImpl control = (DialogControlImpl) o;
if(configNode.hasNodeData("label")){
control.setLabel(NodeDataUtil.getString(configNode, "label"));
}
if(configNode.hasNodeData("description")){
control.setDescription(NodeDataUtil.getString(configNode, "description"));
}
}
}
}