PortalConfig pConfig = dataStorage.getPortalConfig(pcontext.getPortalOwner());
ExoContainer container = ExoContainerContext.getCurrentContainer();
UserACL acl = (UserACL) container.getComponentInstanceOfType(UserACL.class);
UIFormInputSet uiSettingSet = new UIFormInputSet("PageSetting");
uiSettingSet.addUIFormInput(new UIFormStringInput("pageId", "pageId", null).setReadOnly(true));
List<SelectItemOption<String>> ownerTypes = new ArrayList<SelectItemOption<String>>();
if (pConfig != null && acl.hasEditPermission(pConfig)) {
ownerTypes.add(new SelectItemOption<String>(SiteType.PORTAL.getName()));
}
UserPortalConfigService userPortalConfigService = getApplicationComponent(UserPortalConfigService.class);
List<String> groups = userPortalConfigService.getMakableNavigations(pcontext.getRemoteUser(), true);
if (groups.size() > 0) {
ownerTypes.add(new SelectItemOption<String>(SiteType.GROUP.getName()));
}
ownerTypes.add(new SelectItemOption<String>(SiteType.USER.getName()));
UIFormSelectBox uiSelectBoxOwnerType = new UIFormSelectBox(OWNER_TYPE, OWNER_TYPE, ownerTypes);
uiSelectBoxOwnerType.setOnChange("ChangeOwnerType");
uiSettingSet.addUIFormInput(uiSelectBoxOwnerType);
ownerIdInput = new UIFormStringInput(OWNER_ID, OWNER_ID, null);
ownerIdInput.setReadOnly(true).setValue(pcontext.getRemoteUser());
uiSettingSet.addUIFormInput(ownerIdInput);
uiSettingSet
.addUIFormInput(
new UIFormStringInput("name", "name", null).addValidator(UserConfigurableValidator.class, UserConfigurableValidator.PAGE_NAME).addValidator(MandatoryValidator.class))
.addUIFormInput(new UIFormStringInput("title", "title", null).addValidator(StringLengthValidator.class, 3, 120)
.addValidator(NotHTMLTagValidator.class))
.addUIFormInput(new UICheckBoxInput("showMaxWindow", "showMaxWindow", false));
addUIFormInput(uiSettingSet);
setSelectedTab(uiSettingSet.getId());