01: /*
02: * This type of presentation object could be the target of a form's submit
03: * button, process the data, and then decide where to send the user (back or on to the
04: * next page).
05: */
06:
07: package org.enhydra.dm.presentation;
08:
09: import org.enhydra.dm.util.EnhydraDMConstants;
10: import org.enhydra.dm.EnhydraDM;
11:
12: import com.lutris.appserver.server.httpPresentation.HttpPresentationComms;
13:
14: public class Upload extends Base {
15:
16: /*
17: * There is the only function needed in order to be a presentation object.
18: */
19: public void run(HttpPresentationComms comms) throws Exception {
20: UploadHTML page = (UploadHTML) comms.xmlcFactory
21: .create(UploadHTML.class);
22:
23: comms.request.getHttpServletRequest().setCharacterEncoding(
24: EnhydraDMConstants.ENCODING);
25:
26: String documentid = comms.request
27: .getParameter(EnhydraDMConstants.DOCUMENT_ID);
28: String mode = comms.request
29: .getParameter(EnhydraDMConstants.MODE);
30: String user = getUser(comms);
31:
32: if (!EnhydraDMConstants.MODE_TEMPLATE.equals(mode)) {
33: mode = EnhydraDMConstants.MODE_DOCUMENT;
34: }
35:
36: page.getElementDocumentId().setValue(documentid);
37: page.getElementAction().setValue(
38: EnhydraDMConstants.ACTION_CHECKIN);
39: page.getElementUserId().setValue(user);
40: page.getElementMode().setValue(mode);
41: page.getElementAllowedExtensions().setValue(
42: EnhydraDM.allowedExtensionsForUpload);
43:
44: page.getElementBackLink().setHref(
45: EnhydraDMConstants.NAVIG_MANAGER + "?"
46: + EnhydraDMConstants.MODE + "=" + mode);
47:
48: comms.response.writeDOM(page);
49: }
50:
51: }
|