@SuppressWarnings("unchecked")
public UIPageForm(InitParams initParams) throws Exception
{
super("UIPageForm");
PortalRequestContext pcontext = Util.getPortalRequestContext();
UserPortalConfigService configService = getApplicationComponent(UserPortalConfigService.class);
List<SelectItemOption<String>> ownerTypes = new ArrayList<SelectItemOption<String>>();
ownerTypes.add(new SelectItemOption<String>(PortalConfig.USER_TYPE));
UserPortalConfig userPortalConfig =
configService.getUserPortalConfig(pcontext.getPortalOwner(), pcontext.getRemoteUser());
ExoContainer container = ExoContainerContext.getCurrentContainer();
UserACL acl = (UserACL)container.getComponentInstanceOfType(UserACL.class);
if (acl.hasEditPermission(userPortalConfig.getPortalConfig()))
{
ownerTypes.add(new SelectItemOption<String>(PortalConfig.PORTAL_TYPE));
}
ownerIdInput = new UIFormStringInput(OWNER_ID, OWNER_ID, null);
ownerIdInput.setEditable(false).setValue(pcontext.getRemoteUser());
UIFormSelectBox uiSelectBoxOwnerType = new UIFormSelectBox(OWNER_TYPE, OWNER_TYPE, ownerTypes);
uiSelectBoxOwnerType.setOnChange("ChangeOwnerType");
UIFormInputSet uiSettingSet = new UIFormInputSet("PageSetting");
uiSettingSet.addUIFormInput(new UIFormStringInput("pageId", "pageId", null).setEditable(false)).addUIFormInput(
uiSelectBoxOwnerType).addUIFormInput(ownerIdInput).addUIFormInput(
new UIFormStringInput("name", "name", null).addValidator(StringLengthValidator.class, 3, 30).addValidator(
IdentifierValidator.class).addValidator(MandatoryValidator.class)).addUIFormInput(
new UIFormStringInput("title", "title", null).addValidator(StringLengthValidator.class, 3, 120))
.addUIFormInput(new UIFormCheckBoxInput("showMaxWindow", "showMaxWindow", false));
addUIFormInput(uiSettingSet);
setSelectedTab(uiSettingSet.getId());
uiPermissionSetting = createUIComponent(UIFormInputSet.class, "PermissionSetting", null);
UIListPermissionSelector uiListPermissionSelector = createUIComponent(UIListPermissionSelector.class, null, null);
uiListPermissionSelector.configure("UIListPermissionSelector", "accessPermissions");
uiListPermissionSelector.addValidator(EmptyIteratorValidator.class);
uiPermissionSetting.addChild(uiListPermissionSelector);
uiPermissionSetting.setSelectedComponent(uiListPermissionSelector.getId());
UIPermissionSelector uiEditPermission = createUIComponent(UIPermissionSelector.class, null, null);
uiEditPermission.setRendered(false);
uiEditPermission.addValidator(org.exoplatform.webui.organization.UIPermissionSelector.MandatoryValidator.class);
uiEditPermission.setEditable(false);
uiEditPermission.configure("UIPermissionSelector", "editPermission");
uiPermissionSetting.addChild(uiEditPermission);
//TODO: This following line is fixed for bug PORTAL-2127
uiListPermissionSelector.getChild(UIFormPopupWindow.class).setId("UIPageFormPopupGroupMembershipSelector");
List<String> groups = configService.getMakableNavigations(pcontext.getRemoteUser(), true);
if (groups.size() > 0)
{
Collections.sort(groups);
ownerTypes.add(new SelectItemOption<String>(PortalConfig.GROUP_TYPE));
List<SelectItemOption<String>> groupsItem = new ArrayList<SelectItemOption<String>>();