Author: theute
Date: 2011-08-18 17:10:07 -0400 (Thu, 18 Aug 2011)
New Revision: 7182
Modified:
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIContainer.gtmpl
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableColumnContainer.gtmpl
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIToolbarContainer.gtmpl
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortalComposer.gtmpl
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletForm.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerForm.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
Log:
reapplying rollback of r7181
Modified:
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js 2011-08-18
20:46:44 UTC (rev 7181)
+++
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js 2011-08-18
21:10:07 UTC (rev 7182)
@@ -196,6 +196,38 @@
DragDrop.dropCallback = function(dndEvent) {
this.origDragObjectStyle.setProperties(dndEvent.dragObject.style, false) ;
+
+ var hasChanged = true;
+ //When press esc key, we want to cancel the dragdrop, but now it only works with FF
+ if (dndEvent.backupMouseEvent && dndEvent.backupMouseEvent.keyCode == 27
&& eXo.core.Browser.isFF()) {
+ hasChanged = false;
+ }
+ //When dragObject is outside
+ var targetElement = dndEvent.foundTargetObject;
+ if(!targetElement || targetElement.foundIndex == null) {
+ hasChanged = false;
+ }
+ //When dragobject is next to preview object (position is not changed)
+ if(!dndEvent.dragObject.isAddingNewly) {
+ var DOMUtil = eXo.core.DOMUtil;
+ var previewClass = "DragAndDropPreview";
+ var previewTagName = "div";
+ var previewSibling = dndEvent.dragObject;
+ if (dndEvent.dragObject.parentNode.tagName.toLowerCase() == "td") {
+ previewSibling = dndEvent.dragObject.parentNode;
+ previewClass = "PreviewTDBlock";
+ previewTagName = "td";
+ }
+ var tempObj = DOMUtil.findNextElementByTagName(previewSibling, previewTagName);
+ if (tempObj != null && tempObj.className == previewClass) {
+ hasChanged = false;
+ } else {
+ tempObj = DOMUtil.findPreviousElementByTagName(previewSibling, previewTagName);
+ if (tempObj != null && tempObj.className == previewClass) {
+ hasChanged = false;
+ }
+ }
+ }
if(dndEvent.foundTargetObject != null || (dndEvent.backupMouseEvent &&
dndEvent.backupMouseEvent.keyCode != 27)) {
eXo.portal.PortalDragDrop.doDropCallback(dndEvent) ;
@@ -219,7 +251,9 @@
previewBlock = previewTD = null;
eXo.portal.isInDragging = false;
- eXo.portal.UIPortal.changeComposerSaveButton();
+ if (hasChanged) {
+ eXo.portal.UIPortal.changeComposerSaveButton();
+ }
// fix bug WEBOS-196
dndEvent.dragObject.style.width = "auto" ;
};
Modified:
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl 2011-08-18
20:46:44 UTC (rev 7181)
+++
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl 2011-08-18
21:10:07 UTC (rev 7182)
@@ -263,7 +263,7 @@
%>
<div class="PortletIcon $portletIcon"><%=hasPermission
? title : _ctx.appRes("UIPortlet.label.protectedContent")%></div>
<%if(hasPermission) {%>
- <a
href="<%=uicomponent.event("EditPortlet","$uicomponent.id")%>;eXo.portal.UIPortal.changeComposerSaveButton()"
class="EditPortletPropertiesIcon"
title="<%=_ctx.appRes("UIPortlet.tooltip.editPortlet");%>"></a>
+ <a
href="<%=uicomponent.event("EditPortlet","$uicomponent.id")%>;"
class="EditPortletPropertiesIcon"
title="<%=_ctx.appRes("UIPortlet.tooltip.editPortlet");%>"></a>
<a
href="<%=uicomponent.event("DeleteComponent","$uicomponent.id")%>"
class="DeletePortletIcon"
title="<%=_ctx.appRes("UIPortlet.tooltip.deletePortlet");%>"></a>
<%}%>
</div>
Modified:
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIContainer.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIContainer.gtmpl 2011-08-18
20:46:44 UTC (rev 7181)
+++
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIContainer.gtmpl 2011-08-18
21:10:07 UTC (rev 7182)
@@ -42,9 +42,9 @@
<div class="VIEW-CONTAINER VIEW-BLOCK">
<%} %>
<%if(hasPermission) {%>
- <div class="UIRowContainer <%=(portalMode !=
UIPortalApplication.NORMAL_MODE && uicomponent.getChildren().size() == 0) ?
"EmptyContainer" : ""%>">
- <div>
- <%uicomponent.renderChildren();%>
+ <div>
+ <div class="UIRowContainer <%=(portalMode !=
UIPortalApplication.NORMAL_MODE && uicomponent.getChildren().size() == 0) ?
"EmptyContainer" : ""%>">
+ <%uicomponent.renderChildren();%>
</div>
</div>
<%} else out.print("<div
class='ProtectedContent'>"+_ctx.appRes("UIPortlet.label.protectedContent")+"</div>");%>
@@ -72,7 +72,7 @@
%>
<div class="ContainerIcon"><%=hasPermission ? strTitle :
_ctx.appRes("UIPortlet.label.protectedContent")%></div>
<%if(hasPermission) {%>
- <a
href="<%=uicomponent.event("EditContainer")%>;eXo.portal.UIPortal.changeComposerSaveButton()"
class="EditContainerIcon"
title="<%=_ctx.appRes("UIContainer.tooltip.editContainer")%>"><span></span></a>
+ <a
href="<%=uicomponent.event("EditContainer")%>"
class="EditContainerIcon"
title="<%=_ctx.appRes("UIContainer.tooltip.editContainer")%>"><span></span></a>
<a
href="<%=uicomponent.event("DeleteComponent")%>"
class="DeleteContainerIcon"
title="<%=_ctx.appRes("UIContainer.tooltip.closeContainer")%>"><span></span></a>
<%}%>
Modified:
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl 2011-08-18
20:46:44 UTC (rev 7181)
+++
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl 2011-08-18
21:10:07 UTC (rev 7182)
@@ -73,7 +73,7 @@
%>
<div class="ContainerIcon
DefaultContainer16x16Icon"><%=hasPermission ? strTitle :
_ctx.appRes("UIPortlet.label.protectedContent")%></div>
<%if(hasPermission) {%>
- <a
href="<%=uicomponent.event("EditContainer","$uicomponent.id")%>;eXo.portal.UIPortal.changeComposerSaveButton()"
class="EditContainerIcon"
title="<%=_ctx.appRes("UIContainer.tooltip.editContainer")%>"><span></span></a>
+ <a
href="<%=uicomponent.event("EditContainer","$uicomponent.id")%>"
class="EditContainerIcon"
title="<%=_ctx.appRes("UIContainer.tooltip.editContainer")%>"><span></span></a>
<a
href="<%=uicomponent.event("DeleteComponent","$uicomponent.id")%>"
class="DeleteContainerIcon"
title="<%=_ctx.appRes("UIContainer.tooltip.closeContainer")%>"><span></span></a>
<%}%>
</div>
Modified:
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableColumnContainer.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableColumnContainer.gtmpl 2011-08-18
20:46:44 UTC (rev 7181)
+++
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableColumnContainer.gtmpl 2011-08-18
21:10:07 UTC (rev 7182)
@@ -73,7 +73,7 @@
%>
<div class="ContainerIcon
DefaultContainer16x16Icon"><%=hasPermission ? strTitle :
_ctx.appRes("UIPortlet.label.protectedContent")%></div>
<%if(hasPermission) {%>
- <a
href="<%=uicomponent.event("EditContainer","$uicomponent.id")%>;eXo.portal.UIPortal.changeComposerSaveButton()"
class="EditContainerIcon"
title="<%=_ctx.appRes("UIContainer.tooltip.editContainer")%>"><span></span></a>
+ <a
href="<%=uicomponent.event("EditContainer","$uicomponent.id")%>"
class="EditContainerIcon"
title="<%=_ctx.appRes("UIContainer.tooltip.editContainer")%>"><span></span></a>
<a
href="<%=uicomponent.event("DeleteComponent","$uicomponent.id")%>"
class="DeleteContainerIcon"
title="<%=_ctx.appRes("UIContainer.tooltip.closeContainer")%>"><span></span></a>
<%}%>
</div>
Modified:
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIToolbarContainer.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIToolbarContainer.gtmpl 2011-08-18
20:46:44 UTC (rev 7181)
+++
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIToolbarContainer.gtmpl 2011-08-18
21:10:07 UTC (rev 7182)
@@ -70,7 +70,7 @@
%>
<div class="ContainerIcon
DefaultContainer16x16Icon"><%=hasPermission ? strTitle :
_ctx.appRes("UIPortlet.label.protectedContent")%></div>
<%if(hasPermission) {%>
- <a
href="<%=uicomponent.event("EditContainer","$uicomponent.id")%>;eXo.portal.UIPortal.changeComposerSaveButton()"
class="EditContainerIcon"
title="<%=_ctx.appRes("UIContainer.tooltip.editContainer")%>"><span></span></a>
+ <a
href="<%=uicomponent.event("EditContainer","$uicomponent.id")%>;"
class="EditContainerIcon"
title="<%=_ctx.appRes("UIContainer.tooltip.editContainer")%>"><span></span></a>
<a
href="<%=uicomponent.event("DeleteComponent","$uicomponent.id")%>"
class="DeleteContainerIcon"
title="<%=_ctx.appRes("UIContainer.tooltip.closeContainer")%>"><span></span></a>
<%}%>
</div>
Modified:
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortalComposer.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortalComposer.gtmpl 2011-08-18
20:46:44 UTC (rev 7181)
+++
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortalComposer.gtmpl 2011-08-18
21:10:07 UTC (rev 7182)
@@ -52,7 +52,7 @@
<tr>
<td>
- <div onclick="<%= uicomponent.event("ViewProperties")
%>;eXo.portal.UIPortal.changeComposerSaveButton()" class="ActionButton
SimpleStyle1">
+ <div onclick="<%= uicomponent.event("ViewProperties")
%>;" class="ActionButton SimpleStyle1">
<div class="ButtonLeft">
<div class="ButtonRight">
<div class="ButtonMiddle">
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletForm.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletForm.java 2011-08-18
20:46:44 UTC (rev 7181)
+++
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletForm.java 2011-08-18
21:10:07 UTC (rev 7182)
@@ -397,6 +397,7 @@
}
PortalRequestContext pcontext =
(PortalRequestContext)event.getRequestContext();
+
pcontext.getJavascriptManager().addJavascript("eXo.portal.UIPortal.changeComposerSaveButton();");
pcontext.addUIComponentToUpdateByAjax(uiMaskWorkspace);
UIPortalApplication uiPortalApp =
uiPortlet.getAncestorOfType(UIPortalApplication.class);
UIWorkingWorkspace uiWorkingWS =
uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerForm.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerForm.java 2011-08-18
20:46:44 UTC (rev 7181)
+++
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerForm.java 2011-08-18
21:10:07 UTC (rev 7182)
@@ -143,6 +143,7 @@
UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
UIWorkingWorkspace uiWorkingWS =
uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
+
pcontext.getJavascriptManager().addJavascript("eXo.portal.UIPortal.changeComposerSaveButton();");
pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
pcontext.ignoreAJAXUpdateOnPortlets(true);
Util.showComponentLayoutMode(UIContainer.class);
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java 2011-08-18
20:46:44 UTC (rev 7181)
+++
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java 2011-08-18
21:10:07 UTC (rev 7182)
@@ -35,6 +35,8 @@
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainer;
+import org.exoplatform.portal.webui.portal.UIPortal;
+import org.exoplatform.portal.webui.portal.UIPortalComponent;
import org.exoplatform.portal.webui.portal.UIPortalComposer;
import org.exoplatform.portal.webui.util.PortalDataMapper;
import org.exoplatform.portal.webui.util.Util;
@@ -83,6 +85,8 @@
protected UIFormInputSet uiPermissionSetting;
protected UIFormSelectBox groupIdSelectBox = null;
+
+ protected UIFormSelectBox portalIdSelectBox = null;
protected UIFormStringInput ownerIdInput = null;
@@ -99,14 +103,6 @@
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());
@@ -146,6 +142,27 @@
//TODO: This following line is fixed for bug PORTAL-2127
uiListPermissionSelector.getChild(UIFormPopupWindow.class).setId("UIPageFormPopupGroupMembershipSelector");
+ List<String> portals = configService.getAllPortalNames();
+ Collections.sort(portals);
+ List<SelectItemOption<String>> portalsItem = new
ArrayList<SelectItemOption<String>>();
+ ExoContainer container = ExoContainerContext.getCurrentContainer();
+ UserACL acl = (UserACL)container.getComponentInstanceOfType(UserACL.class);
+ for (String p : portals)
+ {
+ UserPortalConfig userPortalConfig = configService.getUserPortalConfig(p,
pcontext.getRemoteUser());
+ if (acl.hasEditPermission(userPortalConfig.getPortalConfig()))
+ {
+ portalsItem.add(new SelectItemOption<String>(p));
+ }
+ }
+ if(portalsItem.size() > 0)
+ {
+ ownerTypes.add(new SelectItemOption<String>(PortalConfig.PORTAL_TYPE));
+ portalIdSelectBox = new UIFormSelectBox(OWNER_ID, OWNER_ID, portalsItem);
+ portalIdSelectBox.setOnChange("ChangeOwnerId");
+ portalIdSelectBox.setParent(uiSettingSet);
+ }
+
List<String> groups =
configService.getMakableNavigations(pcontext.getRemoteUser(), true);
if (groups.size() > 0)
{
@@ -160,6 +177,7 @@
groupIdSelectBox.setOnChange("ChangeOwnerId");
groupIdSelectBox.setParent(uiSettingSet);
}
+
setActions(new String[]{"Save", "Close"});
}
@@ -201,11 +219,6 @@
uiTemplate.setValue(uiPage.getFactoryId());
}
- public void setEditPermission(String per)
- {
-
- }
-
public void invokeSetBindingBean(Object bean) throws Exception
{
String ownerType = getUIFormSelectBox("ownerType").getValue();
@@ -268,7 +281,7 @@
PortalRequestContext pcontext = Util.getPortalRequestContext();
UIMaskWorkspace uiMaskWS =
uiPortalApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
uiMaskWS.setUIComponent(null);
- uiMaskWS.setShow(false);
+ uiMaskWS.setShow(false);
pcontext.addUIComponentToUpdateByAjax(uiMaskWS);
UIPage uiPage = uiPageForm.getUIPage();
@@ -287,6 +300,43 @@
applications.add(PortalDataMapper.buildModelObject(uiPortlet));
}
+ if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()) &&
!Page.DESKTOP_PAGE.equals(page.getFactoryId()))
+ {
+ page.setShowMaxWindow(false);
+ uiPage.getChildren().clear();
+ page.setChildren(applications);
+
+ PortalDataMapper.toUIPage(uiPage, page);
+ if (page.getChildren() == null)
+ page.setChildren(new ArrayList<ModelObject>());
+
+ pcontext.setFullRender(true);
+ UIWorkingWorkspace uiWorkingWS =
uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
+ pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
+
pcontext.getJavascriptManager().addJavascript("eXo.portal.UIPortal.changeComposerSaveButton();");
+ return;
+ }
+
+ if (Page.DESKTOP_PAGE.equals(page.getFactoryId()))
+ {
+ uiPage.getChildren().clear();
+ page.setChildren(applications);
+
+ PortalDataMapper.toUIPage(uiPage, page);
+ if (page.getChildren() == null)
+ page.setChildren(new ArrayList<ModelObject>());
+
+ UIPortalToolPanel toolPanel = Util.getUIPortalToolPanel();
+ toolPanel.setShowMaskLayer(true);
+ pcontext.setFullRender(true);
+ UIWorkingWorkspace uiWorkingWS =
uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
+ pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
+
pcontext.getJavascriptManager().addJavascript("eXo.portal.UIPortal.changeComposerSaveButton();");
+ DataStorage dataService =
uiPageForm.getApplicationComponent(DataStorage.class);
+ dataService.save(page);
+ return;
+ }
+
List<UIComponent> uiChildren = uiPage.getChildren();
if (uiChildren == null)
{
@@ -305,6 +355,7 @@
try{
PortalDataMapper.toUIPage(uiPage, page);
+
pcontext.getJavascriptManager().addJavascript("eXo.portal.UIPortal.changeComposerSaveButton();");
} catch(NoSuchDataException de){
uiPortalApp.addMessage(new
ApplicationMessage("UIPageForm.msg.notExistOrDeleted", null,
ApplicationMessage.ERROR));
UIPortalComposer uiPortalComposer =
(UIPortalComposer)uiPortalApp.findComponentById("UIPageEditor");
@@ -315,7 +366,6 @@
}
uiPage.setStorageId(storageId);
- // if(page.getTemplate() == null) page.setTemplate(uiPage.getTemplate()) ;
if (page.getChildren() == null)
page.setChildren(new ArrayList<ModelObject>());
}
@@ -361,12 +411,28 @@
if (PortalConfig.PORTAL_TYPE.equals(ownerType))
{
list.remove(2);
- list.add(2, uiForm.ownerIdInput);
- uiForm.ownerIdInput.setValue(prContext.getPortalOwner());
- uiForm.findFirstComponentOfType(UIListPermissionSelector.class).setValue(
- Util.getUIPortal().getAccessPermissions());
- uiForm.findFirstComponentOfType(UIPermissionSelector.class).setValue(
- Util.getUIPortal().getEditPermission());
+ list.add(2, uiForm.portalIdSelectBox);
+ String portalIdSelected = uiForm.portalIdSelectBox.getValue();
+ String[] accessPermissions = {};
+ String editPermission = "";
+
+ UserPortalConfigService service =
uiForm.getApplicationComponent(UserPortalConfigService.class);
+ UserPortalConfig userConfig =
service.getUserPortalConfig(portalIdSelected, prContext.getRemoteUser());
+ if (userConfig != null)
+ {
+ PortalConfig config = userConfig.getPortalConfig();
+ accessPermissions = config.getAccessPermissions();
+ editPermission = config.getEditPermission();
+ }
+ else
+ {
+ UIPortal uiPortal =
Util.getUIPortalApplication().getCachedUIPortal(ownerType, portalIdSelected);
+ accessPermissions = uiPortal.getAccessPermissions();
+ editPermission = uiPortal.getEditPermission();
+ }
+
+
uiForm.findFirstComponentOfType(UIListPermissionSelector.class).setValue(accessPermissions);
+
uiForm.findFirstComponentOfType(UIPermissionSelector.class).setValue(editPermission);
}
else
{
@@ -390,13 +456,33 @@
public void execute(Event<UIPageForm> event) throws Exception
{
UIPageForm uiForm = event.getSource();
- String groupIdSelected = uiForm.groupIdSelectBox.getValue();
- groupIdSelected = groupIdSelected.startsWith("/") ? groupIdSelected :
"/" + groupIdSelected;
- String permission = "*:" + groupIdSelected;
- uiForm.findFirstComponentOfType(UIListPermissionSelector.class).setValue(new
String[]{permission});
- UserACL userACL = uiForm.getApplicationComponent(UserACL.class);
- permission = userACL.getMakableMT() + ":" + groupIdSelected;
-
uiForm.findFirstComponentOfType(UIPermissionSelector.class).setValue(permission);
+ UIFormSelectBox uiSelectBox = uiForm.getUIFormSelectBox(OWNER_TYPE);
+ String ownerType = uiSelectBox.getValue();
+ if(PortalConfig.PORTAL_TYPE.equals(ownerType)) {
+ String[] accessPermissions = {};
+ String editPermission = "";
+ String portalIdSelected = uiForm.portalIdSelectBox.getValue();
+ UserPortalConfigService service =
uiForm.getApplicationComponent(UserPortalConfigService.class);
+ UserPortalConfig userConfig = service.getUserPortalConfig(portalIdSelected,
Util.getPortalRequestContext().getRemoteUser());
+ if (userConfig != null)
+ {
+ PortalConfig config = userConfig.getPortalConfig();
+ accessPermissions = config.getAccessPermissions();
+ editPermission = config.getEditPermission();
+
uiForm.findFirstComponentOfType(UIListPermissionSelector.class).setValue(accessPermissions);
+
uiForm.findFirstComponentOfType(UIPermissionSelector.class).setValue(editPermission);
+ }
+ }
+ else
+ {
+ String groupIdSelected = uiForm.groupIdSelectBox.getValue();
+ groupIdSelected = groupIdSelected.startsWith("/") ? groupIdSelected
: "/" + groupIdSelected;
+ String permission = "*:" + groupIdSelected;
+ uiForm.findFirstComponentOfType(UIListPermissionSelector.class).setValue(new
String[]{permission});
+ UserACL userACL = uiForm.getApplicationComponent(UserACL.class);
+ permission = userACL.getMakableMT() + ":" + groupIdSelected;
+
uiForm.findFirstComponentOfType(UIPermissionSelector.class).setValue(permission);
+ }
event.getRequestContext().addUIComponentToUpdateByAjax(uiForm.getParent());
}
}
@@ -406,13 +492,6 @@
public void execute(Event<UIGroupMembershipSelector> event) throws Exception
{
UIPageForm uiForm = event.getSource().getAncestorOfType(UIPageForm.class);
- /*if
(!uiForm.getUIStringInput(OWNER_TYPE).getValue().equals(PortalConfig.GROUP_TYPE))
- return;
- String editPer =
uiForm.findFirstComponentOfType(UIPermissionSelector.class).getValue();
- if (editPer == null || editPer.length() < 1)
- return;
- String group = editPer.substring(editPer.indexOf("/") + 1);
- uiForm.ownerIdInput.setValue(group);*/
event.getRequestContext().addUIComponentToUpdateByAjax(uiForm.getParent());
}
}
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2011-08-18
20:46:44 UTC (rev 7181)
+++
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2011-08-18
21:10:07 UTC (rev 7182)
@@ -348,7 +348,12 @@
UIMaskWorkspace uiMaskWorkspace = uiForm.getParent();
uiMaskWorkspace.setUIComponent(null);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiMaskWorkspace);
+ WebuiRequestContext rContext = event.getRequestContext();
+ if (!uiForm.getId().equals("CreatePortal"))
+ {
+
rContext.getJavascriptManager().addJavascript("eXo.portal.UIPortal.changeComposerSaveButton();");
+ }
+ rContext.addUIComponentToUpdateByAjax(uiMaskWorkspace);
}
}