if(languageId != null && !languageId.equals(""))
request.getSession().setAttribute("structureLanguageId", new Integer(languageId));
SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(new Integer(siteNodeId));
SiteNodeVersionVO siteNodeVersionVO = SiteNodeVersionController.getController().getLatestActiveSiteNodeVersionVO(new Integer(siteNodeId));
if(siteNodeVO != null && hasAccessTo(principal, "Common.CreatePage", true))
{
buttons.add(new ToolbarButton("createSiteNode",
getLocalizedString(locale, "tool.structuretool.toolbarV3.createPageLabel"),
getLocalizedString(locale, "tool.structuretool.toolbarV3.createPageTitle"),
"CreateSiteNode!inputV3.action?isBranch=true&repositoryId=" + siteNodeVO.getRepositoryId() + "&parentSiteNodeId=" + siteNodeId + ((languageId != null && !languageId.equals("")) ? "&languageId=" + languageId : "") + "&returnAddress=ViewInlineOperationMessages.action&originalAddress=refreshParent",
"",
"create"));
ToolbarButton copyPageButton = new ToolbarButton("",
getLocalizedString(locale, "tool.structuretool.toolbarV3.copyPageLabel"),
getLocalizedString(locale, "tool.structuretool.toolbarV3.copyPageLabel"),
"CopyMultipleSiteNodes!input.action?siteNodeId=" + new Integer(siteNodeId) + "&repositoryId=" + siteNodeVO.getRepositoryId() + "&returnAddress=ViewInlineOperationMessages.action&originalAddress=refreshParent" + ((languageId != null && !languageId.equals("")) ? "&sortLanguageId=" + languageId : ""),
"",
"copy");
buttons.add(copyPageButton);
}
ToolbarButton moveSiteNodeButton = new ToolbarButton("moveSiteNode",
getLocalizedString(locale, "tool.structuretool.toolbarV3.movePageLabel"),
getLocalizedString(locale, "tool.structuretool.toolbarV3.movePageTitle"),
"MoveSiteNode!inputV3.action?repositoryId=" + siteNodeVO.getRepositoryId() + "&siteNodeId=" + siteNodeId + "&hideLeafs=true&returnAddress=ViewInlineOperationMessages.action&originalAddress=refreshParent" + ((languageId != null && !languageId.equals("")) ? "&sortLanguageId=" + languageId : ""),
"",
"movePage");
ToolbarButton moveMultipleSiteNodeButton = new ToolbarButton("moveMultipleSiteNode",
getLocalizedString(locale, "tool.structuretool.toolbarV3.moveMultiplePageLabel"),
getLocalizedString(locale, "tool.structuretool.toolbarV3.moveMultiplePageTitle"),
"MoveMultipleSiteNodes!input.action?repositoryId=" + siteNodeVO.getRepositoryId() + "&siteNodeId=" + siteNodeId + "&returnAddress=ViewInlineOperationMessages.action&originalAddress=refreshParent" + ((languageId != null && !languageId.equals("")) ? "&sortLanguageId=" + languageId : ""),
"",
"movePage");
moveSiteNodeButton.getSubButtons().add(moveMultipleSiteNodeButton);
buttons.add(moveSiteNodeButton);
if(siteNodeVO != null && hasAccessTo(principal, "Common.DeletePage", true))
{
String localizedSiteNodeName = null;
try
{
localizedSiteNodeName = ContentController.getContentController().getContentAttribute(siteNodeVO.getMetaInfoContentId(), Integer.valueOf(languageId), "NavigationTitle");
}
catch (NumberFormatException nex)
{
logger.warn("Failed to parse languageId for Delete page toolbar button. Message: " + nex.getMessage());
}
catch (Exception ex)
{
logger.warn("Error looking up localized name for SiteNode for Delete page toolbar botton. Message: " + ex.getMessage());
}
if (localizedSiteNodeName == null || localizedSiteNodeName.equals(""))
{
localizedSiteNodeName = siteNodeVO.getName();
}
ToolbarButton deleteButton = new ToolbarButton("deleteSiteNode",
getLocalizedString(locale, "tool.structuretool.toolbarV3.deletePageLabel"),
getLocalizedString(locale, "tool.structuretool.toolbarV3.deletePageTitle"),
"DeleteSiteNode!V3.action?siteNodeId=" + siteNodeId + "&repositoryId=" + siteNodeVO.getRepositoryId() + "&changeTypeId=4&returnAddress=ViewInlineOperationMessages.action&originalAddress=refreshParent",
"",
"",
"delete",
true,
true,
getLocalizedString(locale, "tool.structuretool.toolbarV3.deletePageLabel"),
getLocalizedString(locale, "tool.structuretool.toolbarV3.deletePageConfirmationLabel", new String[]{localizedSiteNodeName}),
"inlineDiv");
if(SiteNodeVersionController.getLatestPublishedSiteNodeVersionVO(new Integer(siteNodeId)) != null)
{
deleteButton = new ToolbarButton("",
getLocalizedString(locale, "tool.contenttool.toolbarV3.deleteContentLabel"),
getLocalizedString(locale, "tool.contenttool.toolbarV3.deleteContentLabel"),
"javascript:alert('" + formatter.escapeForJavascripts(getLocalizedErrorMessage(locale, "3300")) + "');",
"",
"delete");
}
buttons.add(deleteButton);
}
ToolbarButton pageMetaDataButton = new ToolbarButton("",
getLocalizedString(locale, "tool.structuretool.toolbarV3.editPageMetaInfoLabel"),
getLocalizedString(locale, "tool.structuretool.toolbarV3.editPageMetaInfoTitle"),
"ViewAndCreateContentForServiceBinding.action?siteNodeId=" + siteNodeId + ((languageId != null && !languageId.equals("")) ? "&languageId=" + languageId : "") + "&repositoryId=" + siteNodeVO.getRepositoryId() + "&siteNodeVersionId=" + siteNodeVersionVO.getId() + "&hideLeafs=true&returnAddress=ViewInlineOperationMessages.action&originalAddress=refreshParent",
"",
"properties");
//ToolbarButton pageDetailButton = StructureToolbarController.getPageDetailButtons(siteNodeVO.getRepositoryId(), new Integer(siteNodeId), locale, principal);
//pageMetaDataButton.getSubButtons().add(pageDetailButton);
buttons.add(pageMetaDataButton);
/*
if(siteNodeVO != null && hasAccessTo(principal, "ToolTabsAndButtons.PageSimpleModeButton", true))
{
ToolbarButton pageDetailSimpleButton = StructureToolbarController.getPageDetailSimpleButtons(siteNodeVO.getRepositoryId(), new Integer(siteNodeId), locale, principal);
pageMetaDataButton.getSubButtons().add(pageDetailSimpleButton);
}*/
buttons.add(StructureToolbarController.getPreviewButtons(siteNodeVO.getRepositoryId(), new Integer(siteNodeId), null, locale));
ToolbarButton publishButton = StructureToolbarController.getPublishCurrentNodeButton(siteNodeVO.getRepositoryId(), new Integer(siteNodeId), locale);
ToolbarButton publishStructureButton = StructureToolbarController.getPublishButtons(siteNodeVO.getRepositoryId(), new Integer(siteNodeId), locale);
publishButton.getSubButtons().add(publishStructureButton);
buttons.add(publishButton);
ToolbarButton unpublishAllButton = StructureToolbarController.getUnpublishButton(siteNodeVO.getRepositoryId(), new Integer(siteNodeId), locale, true, false);
ToolbarButton unpublishLatestButton = StructureToolbarController.getUnpublishButton(siteNodeVO.getRepositoryId(), new Integer(siteNodeId), locale, true, true);
unpublishAllButton.getSubButtons().add(unpublishLatestButton);
buttons.add(unpublishAllButton);
ToolbarButton debugContentPublicationButton = new ToolbarButton("",
getLocalizedString(locale, "tool.publishingtool.toolbarV3.forcePublicationLabel"),
getLocalizedString(locale, "tool.publishingtool.toolbarV3.forcePublicationTitle"),
"ViewPublications!showDebugEntityPublication.action?entityName=SiteNode&entityId=" + siteNodeVO.getId(),
"",
"refresh");
publishButton.getSubButtons().add(debugContentPublicationButton);
//publishButton.getSubButtons().add(unpublishStructureButton);
/*
unpublishButton.getSubButtons().add(unpublishStructureButton);
buttons.add(unpublishButton);
*/
if(hasAccessTo(principal, "Common.ManageAccessRights", true) || !CmsPropertyHandler.getHideAccessRightsIfNotAllowedToManage())
{
buttons.add(new ToolbarButton("",
getLocalizedString(locale, "tool.common.accessRights.accessRightsButtonLabel"),
getLocalizedString(locale, "tool.common.accessRights.accessRightsButtonTitle"),
"ViewAccessRights!V3.action?interceptionPointCategory=SiteNodeVersion&extraParameters=" + siteNodeVersionVO.getId() + "&returnAddress=ViewInlineOperationMessages.action&originalAddress=refreshParent",
"css/images/v3/accessRightIcon.gif",
"accessRights"));
}
if(hasAccessTo(principal, "ToolTabsAndButtons.ContentToolbarAdvancedButtons", true))