Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Commit

Permalink
GTNPORTAL-2733 - fixed dashboard tabs for two labeling modes
Browse files Browse the repository at this point in the history
  • Loading branch information
vrockai authored and bdaw committed Nov 23, 2012
1 parent e41c49f commit fc9c992
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,26 @@ public UserNode renamePageNode(String nodeName, String newNodeLabel) {

UserNode renamedNode = parentNode.getChild(nodeName);
renamedNode.setName(newNodeName);
renamedNode.setResolvedLabel(newNodeLabel);

if (renamedNode.getPageRef() != null) {
// Distinguish between "Extended label mode" and basic label mode.
// In "Extended label mode" node.getLabel() == null.
if (renamedNode.getLabel() != null) {
renamedNode.setLabel(newNodeLabel);
} else {
renamedNode.setResolvedLabel(newNodeLabel);
}

// Rename the page only in basic label mode.
// For "Extended label mode" use page editor.
if (renamedNode.getPageRef() != null && renamedNode.getLabel() != null) {
PageContext page = configService.getPageService().loadPage(renamedNode.getPageRef());
if (page != null) {
PageState state = page.getState();
String encodedLabel = HTMLEntityEncoder.getInstance().encode(newNodeLabel);
page.setState(state.builder().displayName(encodedLabel).build());
configService.getPageService().savePage(page);
// Update UIPage cache on UIPortal.
uiPortal.setUIPage(renamedNode.getPageRef().format(), null);
}
}

Expand Down

0 comments on commit fc9c992

Please sign in to comment.