resp.setPortletMode(PortletMode.VIEW);
}
public void render(RenderRequest req, RenderResponse resp) throws PortletException, IOException
{
ResourceURL resourceURL = resp.createResourceURL();
PortletURL actionURL = resp.createActionURL();
//
// Element elt = resp.createElement("script");
// elt.setAttribute("type", "text/javascript");
// elt.setAttribute("src", resourceURL.toString());
// elt.appendChild(elt.getOwnerDocument().createTextNode(""));
// resp.addProperty("script", elt);
//
resp.setContentType("text/html");
PrintWriter writer = resp.getWriter();
writer.print("" +
"<script type=\"text/javascript\">" +
"" +
// "function init(){\n" +
//" Event.observe('repeat', 'keyup', repeat(), false);\n" +
// "}" +
"" +
"function browse(id) {" +
"var url = id;\n" +
"var pars = 'foo=bar';\n" +
"var target = 'output-div';\n" +
"var myAjax = new Ajax.Updater(target, url, {method: 'GET', parameters: pars});" +
"}" +
"</script>");
writer.print("" +
"<div class='full-width' style='padding:5px'>" +
"<h4>Partial Refresh Repeater Demo</h4>");
writer.print("" +
" <div class='half-width float-left'>" +
" <form method='post' id=\"testrepeatform\" name=\"testrepeatform\" action=\"" + actionURL + "\" onsubmit=\"new Ajax.Updater('repeat-div', '" + resourceURL + "', {asynchronous:true, parameters:Form.serialize(this)}); return false;\">\n" +
" <font class='portlet-font'>Repeat Demo:</font><br/>\n" +
" <input class='portlet-form-input-field' type='text' value='' size='12' name=\"repeat\" id=\"repeat\" onkeyup=\"this.form.submit2.click();new Effect.Highlight(document.getElementById('repeat-div'));\"/>\n" +
" <input class='portlet-form-input-field hidden' type='submit' name='submit2' value='submit' style=\"display:hidden;\">\n" +
" </form>\n" +
"</div>" +
"");
writer.print("<div id=\"repeat-container\"><div id=\"repeat-div\" class='half-width float-left' style='height:50px'></div></div>");
// "<input type=\"text\" id=\"hidden-input\" value=\"" + resourceURL.toString() + "\" />" +
// "<a href='javascript:" + resp.getNamespace() + "_handle()'>Click me to trigger script</a>" +
writer.print("<br class='clear'/><br class='clear'/><hr/>" +
"<h4>Partial Refresh Product Catalog</h4>" +
"<div class='full-width'>" +
"");
writer.print("<div class='float-left third-width'>");
resourceURL.setParameter("prodId","1");
writer.print("<a href=\"javascript: browse(\'" + resourceURL + "\');\">Product 1</a><br/>");
resourceURL.setParameter("prodId","2");
writer.print("<a href=\"javascript: browse(\'" + resourceURL + "\');\">Product 2</a><br/>");
resourceURL.setParameter("prodId","3");
writer.print("<a href=\"javascript: browse(\'" + resourceURL + "\');\">Product 3</a><br/>");
writer.print("<br class='clear'/></div>");
writer.print("<div class='float-left two-third-width'>" +
"<h4 class='zero'>Product Details</h4>" +