Hi Ernst,
On Tue, Mar 29, 2011 at 11:17 AM, Ernst Bunders <[email protected]> wrote:
> We are using the simpleMedia module to manager our images, and we thought it
> would be a nice usability enhancement if images would auto-activate after
> uploading.
it's not actually the topic of your mail, but maybe this can be
helpful: do you know that the simplemedia module can also be setup
with a repository shared across the author and the public instance if
you want that images are automatically available on the public side?
After sharing the repository there is a module configuration property
"singleinstance" that can be set to remove all the activation stuff
from the UI (no activation status and menu, any image can immediately
be selected in pages, etc).
You probably have other reasons for auto-activating instead of
sharing, but I wanted to be sure you are aware of that :)
fabrizio
> We achieved this by using module life cycle management to
> register an observer on the media workspace (later we discovered the
> observer module that would have allowed us to do (some of) this in
> repository configuration). This was pretty straight forward. What we did
> find a bit daunting was the way we could figure out to activate content pro
> grammatically.
> We did this by creating our own ActivationCommand instance. We did it like
> so:
> ActivationCommand command = new ActivationCommand();
> command.setRepository("media");
> command.setRecursive(true);
> command.setUuid(node.getUUID());
> command.setRule(RULE);
> Syndicator syndicator =
> Components.getComponentProvider().newInstance(Syndicator.class);
> syndicator.init(
> MgnlContext.getUser(),
> command.getRepository(),
> ContentRepository.getDefaultWorkspace(command.getRepository()),
> RULE);
> command.setSyndicator(syndicator);
> command.execute(MgnlContext.getInstance());
> First we had to do something like
> MgnlContext.setInstance(MgnlContext.getSystemContext());
> As it turned out that the context was not set on the thread local. We
> created a Rule instance with no filters and 'reverse' to 'true'.
> Non of this was problematic, but we had the feeling that this was all a bit
> low level. It would seem that a lot of system knowledge goes into the above
> code, and i was actually surprised it was not easier than this.
> So i actually expect there to be a more high level way to do this. I sort of
> expected something like ActivationUtil, but no dice. Could anybody point me
> in the right direction on this one?
> 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]>
----------------------------------------------------------------