{
Integer repositoryId = new Integer(request.getParameter("repositoryId"));
List<ToolbarButton> buttons = new ArrayList<ToolbarButton>();
buttons.add(new ToolbarButton("previewButton",
getLocalizedString(locale, "tool.publishtool.preview.header"),
getLocalizedString(locale, "tool.publishtool.preview.header"),
"submitToPreview();",
"css/images/v3/previewIcon.png",
"left",
"preview",
true));
buttons.add(new ToolbarButton("createEdition",
getLocalizedString(locale, "tool.publishtool.createEdition.header"),
getLocalizedString(locale, "tool.publishtool.createEdition.header"),
"submitToCreate();",
"css/images/v3/previewIcon.png",
"left",
"create",
true));
buttons.add(new ToolbarButton("unpublishEdition",
getLocalizedString(locale, "tool.publishtool.unpublishEdition.header"),
getLocalizedString(locale, "tool.publishtool.unpublishEdition.header"),
"submitToUnpublish();",
"css/images/v3/trashcan.png",
"left",
"trashcan",
true));
buttons.add(new ToolbarButton("denyPublishing",
getLocalizedString(locale, "tool.publishtool.denyPublication.header"),
getLocalizedString(locale, "tool.publishtool.denyPublication.header"),
"submitToDeny();",
"css/images/v3/denyPublicationIcon.png",
"left",
"denyPublication",
true));
try
{
RepositoryVO repositoryVO = RepositoryController.getController().getRepositoryVOWithId(repositoryId);
String repositoryName = repositoryVO.getName();
String dnsName = repositoryVO.getDnsName();
String previewUrl = null;
String keyword = "preview=";
int startIndex = (dnsName == null) ? -1 : dnsName.indexOf(keyword);
if(startIndex != -1)
{
int endIndex = dnsName.indexOf(",", startIndex);
if(endIndex > -1)
dnsName = dnsName.substring(startIndex, endIndex);
else
dnsName = dnsName.substring(startIndex);
String[] dnsSplit = dnsName.split("=");
if (dnsSplit != null && dnsSplit.length > 1)
{
previewUrl = dnsSplit[1] + CmsPropertyHandler.getComponentRendererUrl().replaceAll("Working", "Preview") + "ViewPage.action";
}
else
{
previewUrl = CmsPropertyHandler.getStagingDeliveryUrl();
}
}
else
{
previewUrl = CmsPropertyHandler.getStagingDeliveryUrl();
}
buttons.add(new ToolbarButton("previewSite",
getLocalizedString(locale, "tool.publishtool.previewEnvironment.header"),
getLocalizedString(locale, "tool.publishtool.previewEnvironment.header"),
"javascript:openPopup('" + previewUrl + "?repositoryName=" + repositoryName + "', 'StagingPreview', 'width=800,height=600,resizable=yes,toolbar=yes,scrollbars=yes,status=yes,location=yes,menubar=yes');",
"css/images/v3/previewIcon.png",
"left",