[opencms-dev] How to save OpenCMS content to external locations?

Paul-Inge Flakstad paulflakstad at gmail.com
Wed Apr 19 09:33:12 CEST 2017


Hi Clement,

First of all: Please make sure to reply on the correct email (not the
digest), keeping the subject line intact.

The modified resource is available via the event object's data map, see
CmsEvent#getData().

So, for example, you might do something like this in your action class:

public void cmsEvent(CmsEvent e) {
    if (e.getType() == I_CmsEventListener.EVENT_RESOURCE_MODIFIED) {
        // Get the resource that was modified
        CmsResource r =
(CmsResource)e.getData().get(I_CmsEventListener.KEY_RESOURCE);
        // See also the other I_CmsEventListener#KEY_XXXX constants, for
more options
        ...
    }
}

Hope this helps :)

Cheers,
Paul

--------

Hi Paul,

Thanks very much for replying!

How might I find out the location of the page the content is located in?

Regards,Clement

On Tue, Apr 18, 2017 at 8:30 PM, Paul-Inge Flakstad <paulflakstad at gmail.com>
wrote:

> Hi Clement,
>
> I'd say go with #1, but in any case, I'd recommend checking out (module)
> action classes:
> http://www.opencms-wiki.org/wiki/Action_classes
>
> In an action class, you can hook into system events—in your case probably
> I_CmsEventListener.EVENT_RESOURCE_MODIFIED
>
> Because they're implemented in modules, action classes provide a clean and
> "pluggable" (=easy to enable/disable) way to handle requirements like yours.
>
> Good luck :)
>
> Cheers,
> Paul
>
> 18. apr. 2017 6.42 p.m. skrev "Clement Wee" <clement at elixirtech.com>:
>
> Hi guys,
>
> Is it possible for me to do one of either of these two actions in OpenCMS:-
>
> (1) Save content to a third-party database when the user clicks on the
> save button in the content editor?
>
> (2) Save the content to another folder in RFS according to page url and
> element id and something extra denoting where the content occurs in the
> page?
>
> I need to do one of these things for a client, and have no idea where to
> start.
>
> Regards,
> Clement
> Singapore
>
> On Tue, Apr 18, 2017 at 6:00 PM, <opencms-dev-request at opencms.org> wrote:
>
>> Send opencms-dev mailing list submissions to
>>         opencms-dev at opencms.org
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>         http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>> or, via email, send a message with subject or body 'help' to
>>         opencms-dev-request at opencms.org
>>
>> You can reach the person managing the list at
>>         opencms-dev-owner at opencms.org
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of opencms-dev digest..."
>>
>>
>> Today's Topics:
>>
>>    1. Adding Function to ADE-Edit-Bar (Patric Dosch)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Tue, 18 Apr 2017 01:56:08 -0700 (MST)
>> From: Patric Dosch <patric.dosch at virtual-identity.com>
>> To: opencms-dev at opencms.org
>> Subject: [opencms-dev] Adding Function to ADE-Edit-Bar
>> Message-ID: <1492505768774-26826.post at n3.nabble.com>
>> Content-Type: text/plain; charset=us-ascii
>>
>> Hey list, I need to add a new Icon - with functionality :) - to the
>> ADE-Edit-Bar.
>> <http://opencms.996256.n3.nabble.com/file/n26826/ade-edit-bar.png>
>>
>>
>> Is this possible via an extension like  adding context menu items
>> <http://documentation.opencms.org/opencms-documentation/exte
>> nding-opencms/adding-context-menu-items-in-the-explorer/>
>> ?
>>
>> Probably the appropriate place must be patched.
>> Has anyone ever done and knows where I can insert my functionality.
>>
>> Regards, Patric
>>
>>
>>
>> --
>> View this message in context: http://opencms.996256.n3.nabbl
>> e.com/Adding-Function-to-ADE-Edit-Bar-tp26826.html
>> Sent from the OpenCMS mailing list archive at Nabble.com.
>>
>>
>> ------------------------------
>>
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please visit
>> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>>
>> End of opencms-dev Digest, Vol 285, Issue 1
>> *******************************************
>>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20170419/3124931a/attachment.htm>


More information about the opencms-dev mailing list