public InformationTab(String id, JetspeedDocument document)
{
super(id, document);
Form infoForm = new Form("infoForm");
Label nameLabel = new Label("name",
new ResourceModel("common.name"));
TextField nameField = new TextField("nameField", new PropertyModel(
this, "document.name"));
infoForm.add(nameLabel);
infoForm.add(nameField);
Label titleLabel = new Label("title", new ResourceModel("Title"));
TextField titleField = new TextField("titleField",
new PropertyModel(this, "document.title"));
infoForm.add(titleLabel);
infoForm.add(titleField);
Label shortTitleLabel = new Label("shortTitle", new ResourceModel(
"ShortTitle"));
TextField shortTitleField = new TextField("shortTitleField",
new PropertyModel(this, "document.shortTitle"));
infoForm.add(shortTitleField);
infoForm.add(shortTitleLabel);
Label pageDecoratorLabel = new Label("pageDecorator",
"Page Decorator");
DropDownChoice decoratorsList = new DropDownChoice(
"decoratorsList", new PropertyModel(this,
"document.pageDecorator"), getPageDecorators());
infoForm.add(decoratorsList);
infoForm.add(pageDecoratorLabel);
Label portletDecoratorLabel = new Label("portletDecorator",
"Portlet Decorator");
DropDownChoice portletDecoratorsList = new DropDownChoice(
"portletDecoratorsList", new PropertyModel(this,
"document.portletDecorator"),
getPortletDecorators());
infoForm.add(portletDecoratorLabel);
infoForm.add(portletDecoratorsList);
Label themeLabel = new Label("theme", "Theme");
DropDownChoice themeField = new DropDownChoice("themeList",
new PropertyModel(this, "document.desktopTheme"),
getThemes());
themeField.setVisibilityAllowed(true);
themeLabel.setVisibilityAllowed(true);
infoForm.add(themeField);
infoForm.add(themeLabel);
Label visibleLabel = new Label("visible", new ResourceModel(
"Hidden"));
CheckBox visibleCheckbox = new CheckBox("visibleCheck",
new PropertyModel(this, "document.hidden"));
infoForm.add(visibleLabel);
infoForm.add(visibleCheckbox);
Label urlLabel = new Label("urlLabel", new ResourceModel("Url"));
TextField urlField = new TextField("urlField", new PropertyModel(
this, "document.url"));
infoForm.add(urlLabel);
infoForm.add(urlField);
urlLabel.setVisibilityAllowed(true);
urlField.setVisibilityAllowed(true);
Label targetLabel = new Label("targetLabel", "Target Window");
DropDownChoice targetField = new DropDownChoice("target",
new PropertyModel(this, "document.target"), getTargetList());
infoForm.add(targetLabel);
infoForm.add(targetField);
targetLabel.setVisibilityAllowed(true);
targetField.setVisibilityAllowed(true);
Label defaultPageLabel = new Label("defaultPage",
new ResourceModel("DefaultPage"));
TextField defaultPageField = new TextField("defaultPageField",
new PropertyModel(this, "document.page"));
infoForm.add(defaultPageLabel);
infoForm.add(defaultPageField);
defaultPageLabel.setVisibilityAllowed(true);
defaultPageField.setVisibilityAllowed(true);
final ModalWindow metaDataModalWindow;
add(metaDataModalWindow = new ModalWindow("modalwindow"));
AjaxButton addFolder = new AjaxButton("addFolder",new ResourceModel("add.subfolder"),infoForm)
{
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form)
{
metaDataModalWindow.setContent(new AddFolderPanel(metaDataModalWindow.getContentId()));
metaDataModalWindow.show(target);
}
};
infoForm.add(addFolder);
AjaxButton addPage = new AjaxButton("addPage",new ResourceModel("add.page"),infoForm)
{
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form)
{
metaDataModalWindow.setContent(new AddPagePanel(
metaDataModalWindow.getContentId()));
metaDataModalWindow.show(target);
}
};
infoForm.add(addPage);
AjaxButton addLink = new AjaxButton("addLink",new ResourceModel("add.link"),infoForm)
{
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form)
{
metaDataModalWindow.setContent(new AddLinkPanel(metaDataModalWindow.getContentId()));
metaDataModalWindow.show(target);
}
};
infoForm.add(addLink);
addFolder.setVisibilityAllowed(true);
addPage.setVisibilityAllowed(true);
addLink.setVisibilityAllowed(true);
SiteTreeNode node = getUserSelectedNode();
if (node.getDocType() == SiteTreeNode.FileType.Folder)
{
urlLabel.setVisible(false);
urlField.setVisible(false);
targetLabel.setVisible(false);
targetField.setVisible(false);
addFolder.setVisible(true);
addPage.setVisible(true);
addLink.setVisible(true);
}
else if (node.getDocType() == SiteTreeNode.FileType.Page)
{
defaultPageLabel.setVisible(false);
defaultPageField.setVisible(false);
urlLabel.setVisible(false);
urlField.setVisible(false);
targetLabel.setVisible(false);
targetField.setVisible(false);
addFolder.setVisible(false);
addPage.setVisible(false);
addLink.setVisible(false);
}
else if (node.getDocType() == SiteTreeNode.FileType.Link)
{
defaultPageLabel.setVisible(false);
defaultPageField.setVisible(false);
targetLabel.setVisible(true);
defaultPageField.setVisible(false);
pageDecoratorLabel.setVisible(false);
decoratorsList.setVisible(false);
portletDecoratorLabel.setVisible(false);
portletDecoratorsList.setVisible(false);
themeField.setVisible(false);
themeLabel.setVisible(false);
addFolder.setVisible(false);
addPage.setVisible(false);
addLink.setVisible(false);
}
if (node.getDocType() == SiteTreeNode.FileType.Link)
{
ExternalLink viewLink = new ExternalLink("view", new Model(getDocument().getUrl()), new ResourceModel("common.view"))
{
@Override
protected void onComponentTag(ComponentTag tag)
{
super.onComponentTag(tag);
if (tag.getName().equalsIgnoreCase("input") && ((getLabel() != null) && (getLabel().getObject() != null)))
{
tag.put("value", getDefaultModelObjectAsString(getLabel().getObject()));
}
}
};
viewLink.setPopupSettings(new PopupSettings());
infoForm.add(viewLink);
}
else
{
RequestContext context = (RequestContext) getPortletRequest().getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
String basePath = context.getPortalURL().getBasePath().replace("portal", "configure");
ExternalLink viewLink = new ExternalLink("view", new Model(basePath + getDocument().getPath()), new ResourceModel("common.view"))
{
@Override
protected void onComponentTag(ComponentTag tag)
{
super.onComponentTag(tag);
if (tag.getName().equalsIgnoreCase("input") && ((getLabel() != null) && (getLabel().getObject() != null)))
{
tag.put("value", getDefaultModelObjectAsString(getLabel().getObject()));
}
}
};
viewLink.setPopupSettings(new PopupSettings());
infoForm.add(viewLink);
}
infoForm.add(new AjaxButton("remove",new ResourceModel("common.remove"),infoForm)
{
@Override
protected void onSubmit(AjaxRequestTarget target, Form form)
{
excuteAction(getDocument(), REMOVE_ACTION);
DefaultMutableTreeNode node = getSelectedNode();
if (node != null && node.getParent() != null)
{
DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) node.getParent();
parentNode.remove(node);
LinkTree tree = (PortalTree) getPage().get("siteTree");
tree.updateTree(target);
}
}
}.add(new JavascriptEventConfirmation("onclick", new ResourceModel("action.delete.confirm"))));
infoForm.add(new AjaxButton("save",new ResourceModel("common.save"), infoForm)
{
@Override
protected void onSubmit(AjaxRequestTarget target, Form form)
{
excuteAction(getDocument(), SAVE_ACTION);
}
});
infoForm.add(new AjaxButton("copy",new ResourceModel("common.copy"),infoForm)
{
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form)
{
SiteTreeNode selectedNode = getUserSelectedNode();
metaDataModalWindow.setContent(new CopyMoveWindow(
metaDataModalWindow.getContentId(), selectedNode
.getDocType().name(), selectedNode
.getNodeName(), getUserSelectedNode()
.getNodePath(), true));
metaDataModalWindow.show(target);
}
});
infoForm.add(new AjaxButton("move",new ResourceModel("common.move"),infoForm)
{
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form)
{