String buttonTitle,
final String completionMessage,
final String resultOverride,
final String idName,
final String className) {
final RequestContext context = request.getContext();
buttonTitle = buttonTitle != null ? buttonTitle : action.getName();
if (action.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
LOG.info("action not visible " + action.getName());
return;
}
final Consent usable = action.isUsable(IsisContext.getAuthenticationSession(), object, where);
if (usable.isVetoed()) {
LOG.info("action not available: " + usable.getReason());
return;
}
/*
*
* TODO this mechanism fails as it tries to process tags - which we dont
* need! Also it calls action 'edit' (not 'action'). Field[] fields =
* new Field[0]; HiddenField[] hiddenFields = new HiddenField[] { new
* HiddenField("service", serviceId), new HiddenField("method",
* methodName), new HiddenField("view", forwardToView), variable == null
* ? null : new HiddenField("variable", variable), };
* Form.createForm(request, buttonTitle, fields, hiddenFields, false);
*/
final String objectId = context.mapObject(object, Scope.INTERACTION);
final String idSegment = idName == null ? "" : ("id=\"" + idName + "\" ");
final String classSegment = "class=\"" + (className == null ? "action in-line" : className) + "\"";
request.appendHtml("\n<form " + idSegment + classSegment + " action=\"action.app\" method=\"post\">\n");
if (objectId == null) {
request.appendHtml(" <input type=\"hidden\" name=\"" + "_" + OBJECT + "\" value=\"" + context.getVariable(RequestContext.RESULT) + "\" />\n");
} else {
request.appendHtml(" <input type=\"hidden\" name=\"" + "_" + OBJECT + "\" value=\"" + StringEscapeUtils.escapeHtml(objectId) + "\" />\n");
}
request.appendHtml(" <input type=\"hidden\" name=\"" + "_" + VERSION + "\" value=\"" + version + "\" />\n");
if (scope != null) {
request.appendHtml(" <input type=\"hidden\" name=\"" + "_" + SCOPE + "\" value=\"" + scope + "\" />\n");
}
request.appendHtml(" <input type=\"hidden\" name=\"" + "_" + METHOD + "\" value=\"" + action.getId() + "\" />\n");
if (forwardResultTo != null) {
forwardResultTo = context.fullFilePath(forwardResultTo);
request.appendHtml(" <input type=\"hidden\" name=\"" + "_" + VIEW + "\" value=\"" + forwardResultTo + "\" />\n");
}
if (forwardErrorTo == null) {
forwardErrorTo = request.getContext().getResourceFile();
}
forwardErrorTo = context.fullFilePath(forwardErrorTo);
request.appendHtml(" <input type=\"hidden\" name=\"" + "_" + ERROR + "\" value=\"" + forwardErrorTo + "\" />\n");
if (forwardVoidTo == null) {
forwardVoidTo = request.getContext().getResourceFile();
}
forwardVoidTo = context.fullFilePath(forwardVoidTo);
request.appendHtml(" <input type=\"hidden\" name=\"" + "_" + VOID + "\" value=\"" + forwardVoidTo + "\" />\n");
if (variable != null) {
request.appendHtml(" <input type=\"hidden\" name=\"" + "_" + RESULT_NAME + "\" value=\"" + variable + "\" />\n");
}
if (resultOverride != null) {