Examples of PortalRequestContext


Examples of org.apache.pluto.driver.core.PortalRequestContext

    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {

        initSupportedModesService();
       
        PortalRequestContext portalRequestContext =
            new PortalRequestContext(getServletContext(), request, response);

        PortalURL portalURL = portalRequestContext.getRequestedPortalURL();
        String actionWindowId = portalURL.getActionWindow();
        PortletWindowConfig actionWindowConfig = getDriverConfiguration()
            .getPortletWindowConfig(actionWindowId);

        // Action window config will only exist if there is an action request.
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

    * @param pcontext
    * @return
    */
   private boolean userHasRightToAddNavigation()
   {
      PortalRequestContext pcontext = Util.getPortalRequestContext();
      String remoteUser = pcontext.getRemoteUser();
      if (remoteUser == null)
      {
         return false;
      }

View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

   static public class AddNavigationActionListener extends EventListener<UIGroupNavigationManagement>
   {
      public void execute(Event<UIGroupNavigationManagement> event) throws Exception
      {
         PortalRequestContext prContext = Util.getPortalRequestContext();
         //UIGroupNavigationManagement uicomp = event.getSource();
         UIPortalApplication uiApp = (UIPortalApplication)prContext.getUIApplication();
         //UIGroupNavigationPortlet uiPortlet = (UIGroupNavigationPortlet) uicomp.getParent();
         UIMaskWorkspace uiMaskWS = uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);

         UIAddGroupNavigation uiNewPortal = uiMaskWS.createUIComponent(UIAddGroupNavigation.class, null, null);
         uiMaskWS.setUIComponent(uiNewPortal);
         uiMaskWS.setShow(true);
         prContext.addUIComponentToUpdateByAjax(uiMaskWS);

      }
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

      public void execute(Event<UISiteManagement> event) throws Exception
      {
         UISiteManagement uicomp = event.getSource();
         String portalName = event.getRequestContext().getRequestParameter(OBJECTID);
         UserPortalConfigService service = uicomp.getApplicationComponent(UserPortalConfigService.class);
         PortalRequestContext prContext = Util.getPortalRequestContext();
         UIPortalApplication portalApp = (UIPortalApplication)prContext.getUIApplication();

         UserPortalConfig userConfig = service.getUserPortalConfig(portalName, prContext.getRemoteUser());

         if (userConfig == null)
         {
            portalApp.addMessage(new ApplicationMessage("UISiteManagement.msg.portal-not-exist",
               new String[]{portalName}));
            return;
         }
         PortalConfig portalConfig = userConfig.getPortalConfig();

         UserACL userACL = portalApp.getApplicationComponent(UserACL.class);
         if (!userACL.hasEditPermission(portalConfig))
         {
            portalApp.addMessage(new ApplicationMessage("UISiteManagement.msg.Invalid-editPermission",
               new String[]{portalConfig.getName()}));
            return;
         }

         UIWorkingWorkspace uiWorkingWS = portalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
         //UIEditInlineWorkspace uiEditWS = uiWorkingWS.addChild(UIEditInlineWorkspace.class, null, UIPortalApplication.UI_EDITTING_WS_ID);
         UIEditInlineWorkspace uiEditWS = uiWorkingWS.getChildById(UIPortalApplication.UI_EDITTING_WS_ID);
         UIPortalComposer uiComposer = uiEditWS.getComposer().setRendered(true);
         uiComposer.setEditted(false);
         uiComposer.setCollapse(false);
         uiComposer.setShowControl(true);
         uiComposer.setComponentConfig(UIPortalComposer.class, null);
         uiComposer.setId("UIPortalComposer");
        
         UIPortal uiPortal = Util.getUIPortal();
         uiWorkingWS.setBackupUIPortal(uiPortal);

         UIPortal editPortal = uiWorkingWS.createUIComponent(UIPortal.class, null, null);
         PortalDataMapper.toUIPortal(editPortal, userConfig);
         uiEditWS.setUIComponent(editPortal);

         // Check if edit current portal
         if (uiPortal.getName().equals(editPortal.getName()))
         {
            editPortal.setSelectedNode(uiPortal.getSelectedNode());
            editPortal.setSelectedNavigation(uiPortal.getSelectedNavigation());
            editPortal.setSelectedPath(uiPortal.getSelectedPath());
            UISiteBody siteBody = uiWorkingWS.findFirstComponentOfType(UISiteBody.class);
            siteBody.setUIComponent(null);
         }

         editPortal.refreshUIPage();
         portalApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
         uiWorkingWS.setRenderedChild(UIPortalApplication.UI_EDITTING_WS_ID);

         prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
         prContext.setFullRender(true);
      }
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

         String portalName = event.getRequestContext().getRequestParameter(OBJECTID);
                 
         UserPortalConfigService service = event.getSource().getApplicationComponent(UserPortalConfigService.class);
         String defaultPortalName = service.getDefaultPortal();

         PortalRequestContext prContext = Util.getPortalRequestContext();
         UIPortalApplication uiPortalApp = Util.getUIPortalApplication();

         if (defaultPortalName.equals(portalName))
         {
            uiPortalApp.addMessage(new ApplicationMessage("UISiteManagement.msg.delete-default-portal",
               new String[]{defaultPortalName}, ApplicationMessage.WARNING));
            return;
         }

         UserPortalConfig config = service.getUserPortalConfig(portalName, prContext.getRemoteUser());
         if (config != null && config.getPortalConfig().isModifiable())
         {
            service.removeUserPortalConfig(portalName);
         }
         else if (config != null)
         {
            uiPortalApp.addMessage(new ApplicationMessage("UISiteManagement.msg.Invalid-deletePermission",
               new String[]{config.getPortalConfig().getName()}));;
            return;
         }
         else
         {
            if (uicomp.stillKeptInPageList(portalName))
            {
               uiPortalApp.addMessage(new ApplicationMessage("UISiteManagement.msg.portal-not-exist",
                  new String[]{portalName}));
            }
            return;
         }

         if (config == null && !Util.getUIPortal().getName().equals(portalName))
         {
            uiPortalApp.addMessage(new ApplicationMessage("UISiteManagement.msg.Invalid-deletePermission",
               new String[]{portalName}));
            return;
         }

         if (config == null || Util.getUIPortal().getName().equals(portalName))
         {
            HttpServletRequest request = prContext.getRequest();
            request.getSession().invalidate();
            prContext.setResponseComplete(true);
            prContext.getResponse().sendRedirect(request.getContextPath());
            return;
         }

         //event.getSource().loadPortalConfigs();
         //UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);   
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

      public void execute(Event<UIPageNodeForm> event) throws Exception
      {
         UIPageNodeForm uiForm = event.getSource();
         UIPageSelector2 pageSelector = uiForm.findFirstComponentOfType(UIPageSelector2.class);

         PortalRequestContext pcontext = Util.getPortalRequestContext();
         UIPortalApplication uiPortalApp = Util.getUIPortalApplication();

         UIFormInputSet uiInputSet = pageSelector.getChild(UIFormInputSet.class);
         List<UIComponent> children = uiInputSet.getChildren();
         /*********************************************************************/
         for (UIComponent uiChild : children)
         {
            if (uiChild instanceof UIFormInputBase)
            {
               UIFormInputBase uiInput = (UIFormInputBase)uiChild;
               if (!uiInput.isValid())
                  continue;
               List<Validator> validators = uiInput.getValidators();
               if (validators == null)
                  continue;
               try
               {
                  for (Validator validator : validators)
                     validator.validate(uiInput);
               }
               catch (MessageException ex)
               {
                  uiPortalApp.addMessage(ex.getDetailMessage());
                  return;
               }
               catch (Exception ex)
               {
                  //TODO:  This is a  critical exception and should be handle  in the UIApplication
                  uiPortalApp.addMessage(new ApplicationMessage(ex.getMessage(), null));
                  return;
               }
            }
         }

         UserACL userACL = uiForm.getApplicationComponent(UserACL.class);

         String ownerId = uiForm.getOwner();
         String[] accessPermission = new String[1];
         accessPermission[0] = "*:" + ownerId;
         String editPermission = userACL.getMakableMT() + ":" + ownerId;
        
         if (PortalConfig.PORTAL_TYPE.equals(uiForm.getOwnerType()))
         {
            UIPortal uiPortal = Util.getUIPortal();
            accessPermission = uiPortal.getAccessPermissions();
            editPermission = uiPortal.getEditPermission();
         }
        
        
         UIFormStringInput uiPageName = uiInputSet.getChildById("pageName");
         UIFormStringInput uiPageTitle = uiInputSet.getChildById("pageTitle");

         Page page = new Page();
         page.setOwnerType(uiForm.getOwnerType());
         page.setOwnerId(ownerId);
         page.setName(uiPageName.getValue());
         String title = uiPageTitle.getValue();;
         if (title == null || title.trim().length() < 1)
            title = page.getName();
         page.setTitle(title);

         page.setShowMaxWindow(false);

         page.setAccessPermissions(accessPermission);
         page.setEditPermission(editPermission);

         userACL.hasPermission(page);

         page.setModifiable(true);
         if (page.getChildren() == null)
            page.setChildren(new ArrayList<ModelObject>());

         // check page is exist
         DataStorage dataService = uiForm.getApplicationComponent(DataStorage.class);
         Page existPage = dataService.getPage(page.getPageId());
         if (existPage != null)
         {
            uiPortalApp.addMessage(new ApplicationMessage("UIPageForm.msg.sameName", null));
            pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
            return;
         }

         // save page to database
         dataService.create(page);
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

         if (!tabPane.validateName(newTabLabel))
         {
            //TODO nguyenanhkien2a@gmail.com
            //We should redirect to current node while adding new tab fails
            PageNode currentNode = tabPane.uiPortal.getSelectedNode();
            PortalRequestContext prContext = Util.getPortalRequestContext();
            prContext.getResponse().sendRedirect(prContext.getPortalURI() + currentNode.getUri());
           
            Object[] args = {newTabLabel};
            context.getUIApplication().addMessage(new ApplicationMessage("UITabPaneDashboard.msg.wrongTabName", args));
            return;
         }
         String uri = tabPane.createNewPageNode(newTabLabel);

         //If new node is created with success, then redirect to it
         if (uri != null)
         {
            PortalRequestContext prContext = Util.getPortalRequestContext();
            prContext.setResponseComplete(true);
            prContext.getResponse().sendRedirect(prContext.getPortalURI() + uri);
         }
      }
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

         if (!tabPane.validateName(newTabLabel))
         {
            //TODO nguyenanhkien2a@gmail.com
            //We should redirect to current node while renaming fails
            PageNode currentNode = tabPane.uiPortal.getSelectedNode();
            PortalRequestContext prContext = Util.getPortalRequestContext();
            prContext.getResponse().sendRedirect(prContext.getPortalURI() + currentNode.getUri());
           
            Object[] args = {newTabLabel};
            context.getUIApplication().addMessage(new ApplicationMessage("UITabPaneDashboard.msg.wrongTabName", args));
            return;
         }
         String newUri = tabPane.renamePageNode(nodeIndex, newTabLabel);

         //If page node is renamed with success, then redirect to new URL
         if (newUri != null)
         {
            PortalRequestContext prContext = Util.getPortalRequestContext();
            prContext.getResponse().sendRedirect(prContext.getPortalURI() + newUri);
         }
      }
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

      UIApplication uiApp = context.getUIApplication();
      UIPopupMessages popupMessages = uiApp.getUIPopupMessages();
      if(popupMessages.getWarnings().size() > 0 || popupMessages.getErrors().size() > 0)
      {
         //Invalidate the capcha
         PortalRequestContext prContext = Util.getPortalRequestContext();
         HttpServletRequest request = prContext.getRequest();
         HttpSession session = request.getSession();
         session.removeAttribute(Captcha.NAME);
         context.addUIComponentToUpdateByAjax(getChild(UIRegisterInputSet.class));
      }
   }
View Full Code Here

Examples of org.exoplatform.portal.application.PortalRequestContext

    * portlet. Later it will be implemented with a finer granilarity.
    */
   public boolean canEdit()
   {
      PortletRequestContext context = (PortletRequestContext)WebuiRequestContext.getCurrentInstance();
      PortalRequestContext prc = (PortalRequestContext)context.getParentAppRequestContext();
      UIPortalApplication portalApp = (UIPortalApplication)prc.getUIApplication();
      UIPortal portal = portalApp.getShowedUIPortal();

      //
      try
      {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.