AnsweredAssumed Answered

WebScriptPortlet Edit Mode

Question asked by thagan on Sep 28, 2007
Latest reply on May 12, 2008 by kimmoilppola
Hi there

I'm developing a portlet under Liferay 4.3.1 using Alfresco 2.1.
I extended WebScriptPortlet and I would like to customize its behavior when in EDIT-MODE.

This is the render() method on the original WebScriptPortlet:

        if (PortletMode.VIEW.equals(portletMode))
           doView(req, res);
//        else if (PortletMode.HELP.equals(portletMode))
//        {//           doHelp(req, res);
//        }
//      else if (PortletMode.EDIT.equals(portletMode))
//      {
//         doEdit(req, res);
//      }

I redefined the render() method uncommenting the code related to EDIT-MODE case and creating a customized doEdit() method.

I also added the highlighted entry in the following code on portlet.xml:

            <portlet-mode>EDIT</portlet-mode> <!– my entry –>

When I execute my portlet, the VIEW-MODE works fine, but the EDIT-MODE doesn't.
I would expect that when i click on [img][/img] button on the top bar, my portlet was executed as follows:
render() -> if on EDIT-MODE -> doEdit().
But render() method isn't invoked.

Instead of that, the [img][/img] button redirects to the following url:
javascript: self.location = 'http%3A%2F%2Flocalhost%3A8080%2Fuser%2Fjoebloggs%2F2%3Fp_p_id%3D86%26p_p_action
%252F2&_86_previewWidth=' + document.getElementById('p_p_id_AlfrescoLancioPortlet_WAR_alfresco_').offsetWidth;

The (longest ever :D ) url takes to the following page (I created my portlet backing up "My Web Files" portlet and customizing it):

I tried to find a jsp or an xml file where the portlet top bar commands are defined and configured, but I didn't find it.

Summing up, when I click on [img][/img] button, I want my portlet to be executed in the same way as for VIEW-MODE except for the portlet-mode parameter which should be set with EDIT value (edit or EDIT is the same).

Thanks in advance