<%@ page language="java" import="revize.data.*, revize.servlet.*,revize.store.*, idetix.security.UserContext,revize.request.*,idetix.util.StringUtils " %>
<%@ page errorPage="/revize/admincenter/error.jsp" %>
<%
// Get data and setup the action for use at submit time
String visualAction = "Create";
Record record = null;
Module module = null;
String moduleLabel = "";
String [] fieldLabels = null;
String [] fieldValues = null;
int [] fieldTypes = null;
boolean isNewRecord = true;
// determine webSpace. If a specific web space was used for the last
// request, we want to know that.
String webSpaceName = SessionAccess.getWebSpaceName( request );
String requestWebSpaceName = (String)request.getAttribute(
XmlRequestServlet.WEBSPACE_NAME_ATTRIBUTE );
if ( requestWebSpaceName != null && requestWebSpaceName.length() > 0 )
{
webSpaceName = requestWebSpaceName;
}
String action = (String)request.getAttribute(
XmlRequestServlet.ACTION_ATTRIBUTE );
Object result = request.getAttribute (
XmlRequestServlet.RESULT_ATTRIBUTE );
//If we are creating a new record the result of the call to XmlRequestServlet contains
//the Module to which the record is being added. Otherwise when we are updating a record,
//the result contains the Record to be updated.
if ( result instanceof Record )
{
record = (Record)result;
}
else if ( result instanceof Module )
{
module = (Module)result;
}
if ( action != null && action.equalsIgnoreCase( "read" ) && record != null )
{
visualAction = "Update";
isNewRecord = false;
}
if ( !isNewRecord )
{
moduleLabel = record.getModuleName();
DataStore dataStore = DataStoreFactory.createDefault( webSpaceName );
module = dataStore.readModule( moduleLabel );
}
//Get the fieldDefs od the module to access field labels and types.
FieldDef [] fieldDefs = module.getFieldDefsArray();
fieldLabels = new String[ fieldDefs.length ];
fieldValues = new String[ fieldDefs.length ];
fieldTypes = new int[ fieldDefs.length ];
for ( int i=0; i