5 Replies Latest reply on Jun 25, 2008 7:50 PM by Ciro Cavani

    Multi-CMSPortletWindow uri change with one URL

    Ciro Cavani Novice

      Hi,

      I have three CMSPortletWindow in the same Portal Page: List, Content, Related.

      In CMS, I have something like:

      index.html
      Item1/index.html
      Item1/index_related.html
      Item1/file1.html
      Item1/file1_related.html
      ...
      ItemN/index.html
      ItemN/index_related.html
      ItemN/fileK.html
      ItemN/fileK_related.html

      index.html is a list of all ItemN/index.html and is shown at List.

      When user click in some link on List the expected behavior is:

      Content shows ItemN/index.html
      Related shows ItemN/index_related.html

      ItemN/index.html is a list of all ItemN/fileK.html

      Again, when user click in some link on Content:

      Content shows ItemN/fileK.html
      Related shows ItemN/fileK_related.html

      I am using the following address in index.html (a href):

      /portal/MyPortal/default/Content?action=2&uri=/ItemN/index.html
      


      This allow I have bookmarkable pages.

      I am trying to implement and IPC that allow WindowNavigationEvent to be evaluated by both windows: Content and Related.

      My idea was using an listener on page to intercept the event to Content and returning an equivalent event to Related (changing uri) and again returning an event to Content, but I realize just the last returned event take effect over window content.

      This problem can be solved with IPC?

      Is there any way to intercept an node event and fire another and both take effect?

      Any idea other idea?

      (I can post the related code to clarify my current idea)

      Thanks,

        • 1. Re: Multi-CMSPortletWindow uri change with one URL
          zeenia arora Newbie

          I have read that you have made an application on Multi-CMSPortletWindow uri change with one URL.
          I'm working on the same thing,so if i can get your complete code,i'll be in a better position to understand what you are doing actually.

          looking forward to your reply

          thanks.


          My e-mail Id-- zeenia.arora@lntinfotech.com

          • 2. Re: Multi-CMSPortletWindow uri change with one URL
            Ciro Cavani Novice

            It is not working yet.

            I get the following "a href" updating Related but Content don't change (with IPC):

            /portal/MyPortal/default/Content?action=2&uri=/ItemN/index.html
            


            I will separate the IPC code for test soon and post it.

            Let me know if you get it working.

            thanks,

            • 3. Re: Multi-CMSPortletWindow uri change with one URL
              Ciro Cavani Novice

              This is a simple code that I isolated to further tests:

              public class Listener implements PortalNodeEventListener
              {
              
               public PortalNodeEvent onEvent(final PortalNodeEventContext context, final PortalNodeEvent event)
               {
               if (!(event instanceof WindowNavigationEvent))
               return context.dispatch();
              
               final WindowNavigationEvent windowEvent = (WindowNavigationEvent) event;
              
               final PortalNode node = windowEvent.getNode();
              
               if (!node.getName().equals("Content"))
               return context.dispatch();
              
               final Map<String, String[]> parameters = windowEvent.getParameters();
              
               final String[] param = parameters.get("uri");
              
               if (param == null || param.length == 0 || param[0] == null || param[0].trim().equals(""))
               return context.dispatch();
              
               final String uri = param[0].replace(".html", "_related.html");
              
               final PortalNode otherNode = node.resolve("../Related");
              
               WindowNavigationEvent otherEvent = new WindowNavigationEvent(otherNode);
              
               Map<String, String[]> otheParameters = new HashMap<String, String[]>();
               otheParameters.put("uri", new String[] { uri });
              
               otherEvent.setParameters(otheParameters);
              
               return otherEvent;
               }
              
              }
              


              I set this listener on Content window.

              Its working as I said before: No Content update, just Related.

              Thanks,

              • 4. Re: Multi-CMSPortletWindow uri change with one URL
                Ciro Cavani Novice

                Hey dude... I am feeling very stuped right now, but know I get it!

                Try it:

                public class Listener implements PortalNodeEventListener
                {
                
                 private String uri;
                
                 public PortalNodeEvent onEvent(final PortalNodeEventContext context, final PortalNodeEvent event)
                 {
                 if (event instanceof WindowNavigationEvent)
                 {
                 final WindowNavigationEvent windowEvent = (WindowNavigationEvent) event;
                
                 final PortalNode node = windowEvent.getNode();
                
                 if (!node.getName().equals("Content"))
                 return context.dispatch();
                
                 final Map<String, String[]> parameters = windowEvent.getParameters();
                
                 final String[] param = parameters.get("uri");
                
                 if (param == null || param.length == 0 || param[0] == null || param[0].trim().equals(""))
                 return context.dispatch();
                
                 uri = param[0].replace(".html", "_related.html");
                 }
                 else if (event instanceof WindowRenderEvent)
                 {
                 final WindowRenderEvent windowEvent = (WindowRenderEvent) event;
                
                 final PortalNode node = windowEvent.getNode();
                
                 if (!node.getName().equals("Related"))
                 return context.dispatch();
                
                 Map<String, String[]> parameters = windowEvent.getParameters();
                
                 parameters.put("uri", new String[] { uri });
                
                 uri = null;
                 }
                
                 return context.dispatch();
                 }
                
                }
                


                Thanks,

                • 5. Re: Multi-CMSPortletWindow uri change with one URL
                  Ciro Cavani Novice

                  Oops... listener binging to page.... no Content...

                  Damn!!....

                  Thanks,