* @exception Exception, a generic exception.
*/
public ConcreteElement doBuild( RunData data )
throws Exception
{
ElementContainer body = new ElementContainer()
.addElement(new HR().setSize(1).setNoShade(true))
.addElement(new B().addElement(
new Font().setColor(HtmlColor.green).setSize(2)
.addElement("Turbine - A Servlet Framework for building Secure Dynamic Websites.")))
.addElement( new Form( new DynamicURI ( data, "DefaultScreen", "LogoutUser", true ).toString(),
Form.POST ).addElement(new Input("SUBMIT", "Logout", "Logout") ) );
if (DEBUG && data.getUser() != null)
{
TD perm = new TD().setVAlign(AlignType.TOP);
TD temp = new TD().setVAlign(AlignType.TOP);
java.util.Enumeration ePerm = data.getUser().getPermStorage().keys();
java.util.Enumeration eTemp = data.getUser().getTempStorage().keys();
perm.addElement("Perm values:").addElement( new BR() );
temp.addElement("Temp values:").addElement( new BR() );
while ( ePerm.hasMoreElements() )
{
String key = (String) ePerm.nextElement();
String value = data.getUser().getPerm(key).toString();
perm.addElement( key + "=" + value )
.addElement( new BR() );
}
while ( eTemp.hasMoreElements() )
{
String key = (String) eTemp.nextElement();
String value = data.getUser().getTemp(key).toString();
temp.addElement( key + "=" + value )
.addElement( new BR() );
}
body.addElement(new BR()).addElement(new BR())
.addElement(new Table().setBorder(2).setCellPadding(10)
.addElement(new TR()
.addElement(perm).addElement(temp) ));
}
if (DEBUG)
{
// If there are GET/POST/PATH_INFO variables put them into
// a <PRE></PRE> tag so that they can be displayed on the
// page. This is of course only for example purposes.
PRE pre = new PRE();
Enumeration keys = data.getParameters().keys();
while ( keys.hasMoreElements() )
{
String key = (String) keys.nextElement();
String[] values = data.getParameters().getStrings(key);
if (values.length == 1)
pre.addElement(key + " = " + values[0] + "\n");
else
{
pre.addElement(key + " = ");
for (int i=0; i<values.length; i++)
pre.addElement(values[i] + " ");
pre.addElement("\n");
}
}
body.addElement( new B("Query/PathInfo Parameters") )
.addElement( new BR() )
.addElement(pre);
Table table2 = new Table().setBorder(0);
Hashtable varDebug = data.getVarDebug();
keys = varDebug.keys();
boolean hasValues2 = false;
while ( keys.hasMoreElements() )
{
String key = (String) keys.nextElement();
String value = varDebug.get(key).toString();
TR tr = new TR()
.addElement ( new TD().addElement(new B(key)) )
.addElement ( new TD().addElement(" = " + value ) );
table2.addElement(tr);
hasValues2 = true;
}
if ( hasValues2 )
{
body.addElement (new H4().addElement("Debugging Data:"));
body.addElement (table2);
}
}
if (DEBUG && data.getACL() != null)
{
// Print out user's permissions.
PRE pre = new PRE();
Iterator rs = data.getACL().getRoles().elements();
while ( rs.hasNext() )
{
String roleName = ((Role)rs.next()).getName();
pre.addElement(roleName + "\n");
}
body
.addElement( new BR() )
.addElement( new B("ROLES") )
.addElement( new BR() )
.addElement(pre);
pre = new PRE();
Iterator ps = data.getACL().getPermissions().elements();
while ( ps.hasNext() )
{
String permissionName = ((Permission)ps.next()).getName();
pre.addElement(permissionName + "\n");
}
body
.addElement( new BR() )
.addElement( new B("PERMISSIONS") )
.addElement( new BR() )
.addElement(pre);