String portalName = event.getRequestContext().getRequestParameter(OBJECTID);
UserPortalConfigService service = uicomp.getApplicationComponent(UserPortalConfigService.class);
DataStorage dataStorage = uicomp.getApplicationComponent(DataStorage.class);
PortalRequestContext prContext = Util.getPortalRequestContext();
UIPortalApplication portalApp = (UIPortalApplication) prContext.getUIApplication();
UIWorkingWorkspace uiWorkingWS = portalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
PortalConfig pConfig = dataStorage.getPortalConfig(portalName);
if (pConfig == null) {
portalApp.addMessage(new ApplicationMessage("UISiteManagement.msg.portal-not-exist",
new String[] { portalName }));
uiWorkingWS.updatePortletsByName("UserToolbarSitePortlet");
return;
}
UserACL userACL = portalApp.getApplicationComponent(UserACL.class);
if (!userACL.hasEditPermission(pConfig)) {
portalApp.addMessage(new ApplicationMessage("UISiteManagement.msg.Invalid-editPermission",
new String[] { pConfig.getName() }));
return;
}
// 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_COMPOSER);
UIPortal uiPortal = Util.getUIPortal();
uiWorkingWS.setBackupUIPortal(uiPortal);
UIPortal editPortal = uiWorkingWS.createUIComponent(UIPortal.class, null, null);
PortalDataMapper.toUIPortal(editPortal, pConfig);
uiEditWS.setUIComponent(editPortal);
// Check if edit current portal
if (uiPortal.getName().equals(editPortal.getName())) {
// editPortal.setSelectedNode(uiPortal.getSelectedNode());
// editPortal.setNavigation(uiPortal.getNavigation());
// editPortal.setSelectedPath(uiPortal.getSelectedPath());
editPortal.setNavPath(uiPortal.getNavPath());
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.ignoreAJAXUpdateOnPortlets(true);
}