// make the list of already used panes/portlets available through the 'runs' reference
context.put("runs", AutoProfile.getPortletList(rundata));
// we should first retrieve the portlet to customize
PortletSet set = (PortletSet) (jdata).getCustomized();
//identify the portlet submode and build the appropriate subt-template path
String mode = rundata.getParameters().getString("mode");
if (mode == null)
{
mode = (String) customizationState.getAttribute("customize-mode");
if ((mode == null) || (mode.equalsIgnoreCase("addset")) || (mode.equalsIgnoreCase("general")))
{
mode = "layout";
}
}
else
{
if ((mediaType.equalsIgnoreCase("wml")) && (!mode.equalsIgnoreCase("add")))
{
mode = "layout";
}
customizationState.setAttribute("customize-mode", mode);
}
String template = (String) context.get("template");
if (template != null)
{
int idx = template.lastIndexOf(".");
if (idx > 0)
{
template = template.substring(0, idx);
}
StringBuffer buffer = new StringBuffer(template);
buffer.append("-").append(mode).append(".vm");
template = TemplateLocator.locatePortletTemplate(rundata, buffer.toString());
context.put("feature", template);
}
if (set == null)
{
return;
}
// get the customization state for this page
String customizedPaneName = (String) customizationState.getAttribute("customize-paneName");
if (customizedPaneName == null)
{
customizedPaneName = "*";
}
// generic context stuff
context.put("panename", customizedPaneName);
context.put("skin", set.getPortletConfig().getPortletSkin());
context.put("set", set);
context.put("action", "portlets.CustomizeSetAction");
context.put("controllers", buildInfoList(rundata, Registry.PORTLET_CONTROLLER, mediaType));
//context.put("skins", buildList(rundata, Registry.SKIN));
//context.put("securitys", buildList(rundata, Registry.SECURITY));
context.put("customizer", portlet);
String controllerName = set.getController().getConfig().getName();
context.put("currentController", controllerName);
context.put("currentSecurityRef", set.getPortletConfig().getSecurityRef());
/**
* Special handling for wml profiles
* no skins, no properties menuentry, no panes
* --------------------------------------------------------------------------
* last modified: 12/10/01
* Andreas Kempf, Siemens ICM S CP OP, Munich
* mailto: A.Kempf@web.de
*/
if (mediaType.equalsIgnoreCase("wml"))
{
context.put("currentSkin", "Not for wml!");
context.put("allowproperties", "false");
}
else
{
if (set.getPortletConfig().getSkin() != null)
{
context.put("currentSkin", set.getPortletConfig().getPortletSkin().getName());
}
context.put("allowproperties", "true");
}
context.put("allowpane", "false");
// do not allow panes for wml profiles
if ((!mediaType.equalsIgnoreCase("wml")) && (set.getController() instanceof PortletSetController))
{
if (customizedPaneName != null)
{
context.put("allowpane", "true");
}