Author: ndkhoiits
Date: 2010-04-13 03:06:53 -0400 (Tue, 13 Apr 2010)
New Revision: 2598
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java
Log:
GTNPORTAL-1059 Delete or cut a system node is unallowable
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2010-04-13
07:04:29 UTC (rev 2597)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2010-04-13
07:06:53 UTC (rev 2598)
@@ -248,6 +248,18 @@
}
}
+ public boolean isSystem() {
+ switch(visibility) {
+ case SYSTEM:
+ return true;
+ case TEMPORAL:
+ case HIDDEN:
+ case DISPLAYED:
+ return false;
+ default:
+ throw new AssertionError();
+ }
+ }
public void setVisible(Boolean b)
{
if (b != null)
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2010-04-13
07:04:29 UTC (rev 2597)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2010-04-13
07:06:53 UTC (rev 2598)
@@ -1088,6 +1088,13 @@
UIGroupManagement.msg.DeleteMandatory=You can't delete this group because it (or its
child) is mandatory.
###############################################################################
+ # org.exoplatform.portal.webui.navigation.UINavigationNodeSelector #
+ ###############################################################################
+UINavigationNodeSelector.msg.systemnode-delete=Cannot delete a system node
+UINavigationNodeSelector.msg.systemnode-move=Cannot cut a system node
+
+
+ ###############################################################################
# org.exoplatform.portal.webui.component.customization.UIEditCurentPage #
###############################################################################
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java 2010-04-13
07:04:29 UTC (rev 2597)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java 2010-04-13
07:06:53 UTC (rev 2598)
@@ -579,13 +579,46 @@
{
public void execute(Event<UIRightClickPopupMenu> event) throws Exception
{
- super.execute(event);
- UINavigationNodeSelector uiNodeSelector =
event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
- if (uiNodeSelector.getCopyNode() == null)
- {
- return;
- }
- uiNodeSelector.getCopyNode().setDeleteNode(true);
+ String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
+ WebuiRequestContext pcontext = event.getRequestContext();
+ UIApplication uiApp = pcontext.getUIApplication();
+ UINavigationNodeSelector uiNodeSelector =
event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
+ UINavigationManagement uiManagement = uiNodeSelector.getParent();
+ Class<?>[] childrenToRender = new
Class<?>[]{UINavigationNodeSelector.class};
+ uiManagement.setRenderedChildrenOfTypes(childrenToRender);
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiManagement);
+
+ PageNavigation nav = uiNodeSelector.getSelectedNavigation();
+ if (nav == null)
+ {
+ return;
+ }
+
+ PageNode[] pageNodes = PageNavigationUtils.searchPageNodesByUri(nav, uri);
+ if (pageNodes == null)
+ {
+ return;
+ }
+
+ for (PageNode pageNode : pageNodes) {
+ if(pageNode != null && pageNode.isSystem()) {
+ uiApp.addMessage(new
ApplicationMessage("UINavigationNodeSelector.msg.systemnode-move", null,
ApplicationMessage.ERROR));
+ return;
+ }
+ }
+
+ SelectedNode selectedNode = new SelectedNode(nav, pageNodes[0], pageNodes[1]);
+ selectedNode.setDeleteNode(false);
+ uiNodeSelector.setCopyNode(selectedNode);
+ event.getSource().setActions(
+ new String[]{"AddNode", "EditPageNode",
"EditSelectedNode", "CopyNode", "CloneNode",
"CutNode",
+ "PasteNode", "DeleteNode", "MoveUp",
"MoveDown"});
+
+ if (uiNodeSelector.getCopyNode() == null)
+ {
+ return;
+ }
+ uiNodeSelector.getCopyNode().setDeleteNode(true);
}
}
@@ -806,6 +839,7 @@
{
String uri =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
WebuiRequestContext pcontext = event.getRequestContext();
+ UIApplication uiApp = pcontext.getUIApplication();
UINavigationNodeSelector uiNodeSelector =
event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
pcontext.addUIComponentToUpdateByAjax(uiNodeSelector);
@@ -823,9 +857,21 @@
if (pageNodes[0] == null)
{
+ if(pageNodes[1].isSystem()) {
+ uiApp.addMessage(new
ApplicationMessage("UINavigationNodeSelector.msg.systemnode-delete", null,
ApplicationMessage.ERROR));
+ return;
+ }
+
nav.getNodes().remove(pageNodes[1]);
return;
}
+
+ for (PageNode pageNode : pageNodes) {
+ if(pageNode.isSystem()) {
+ uiApp.addMessage(new
ApplicationMessage("UINavigationNodeSelector.msg.systemnode-delete", null,
ApplicationMessage.ERROR));
+ return;
+ }
+ }
pageNodes[0].getChildren().remove(pageNodes[1]);
uiNodeSelector.selectPageNodeByUri(pageNodes[0].getUri());
}
Show replies by date