001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/sam/tags/sakai_2-4-1/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/FileUploadBean.java $
003: * $Id: FileUploadBean.java 15083 2006-09-20 20:03:55Z lydial@stanford.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2004, 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the"License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.tool.assessment.ui.bean.author;
021:
022: import java.io.Serializable;
023: import java.util.ArrayList;
024: import java.util.Collection;
025:
026: import org.apache.struts.upload.FormFile;
027:
028: /**
029: * <p>
030: * Title: sakaiproject.org
031: * </p>
032: *
033: * <p>
034: * Description: form for uploading media.
035: * </p>
036: *
037: * Copyright 2003, Trustees of Indiana University, The Regents of the University
038: * of Michigan, and Stanford University, all rights reserved.
039: *
040: * Used to be org.navigoproject.ui.web.form.edit.FileUploadForm.java
041: *
042: * @author Rachel Gollub
043: * @author Qingru Zhang
044: * @author Ed Smiley
045: * @version 1.0
046: */
047: public class FileUploadBean implements Serializable {
048: /**
049: *
050: */
051: private static final long serialVersionUID = -6101267878345384445L;
052: private String source;
053: private FormFile newfile;
054: private String link;
055: private String name;
056: private String title;
057: private String description;
058: private String author;
059: private String filename;
060: private String type;
061: private boolean isEdit;
062: private boolean isHtmlInline;
063: private Collection mediaTypes;
064: private String mapId;
065: // displayed as image true or false
066: private boolean isHtmlImage;
067: // image attributes
068: private String imageAlt;
069: private String imageVspace;
070: private String imageHspace;
071: private String imageAlign;
072: private String imageBorder;
073: // item_ident_ref is the id of an answer (item_result) submitted by user
074: private String itemIdentRef;
075: private String userName;
076:
077: /**
078: * Creates a new FileUploadBean object.
079: */
080: public FileUploadBean() {
081: resetFields();
082: }
083:
084: /**
085: * DOCUMENTATION PENDING
086: *
087: * @return DOCUMENTATION PENDING
088: */
089: public String getSource() {
090: return source;
091: }
092:
093: /**
094: * DOCUMENTATION PENDING
095: *
096: * @param psource DOCUMENTATION PENDING
097: */
098: public void setSource(String psource) {
099: source = psource;
100: }
101:
102: /**
103: * FormFile is a file upload file.
104: *
105: * @return FormFile file upload file.
106: */
107: public FormFile getNewfile() {
108: return newfile;
109: }
110:
111: /**
112: * FormFile is a file upload file.
113: *
114: * @param pnewfile FormFile file upload file.
115: */
116: public void setNewfile(FormFile pnewfile) {
117: newfile = pnewfile;
118: }
119:
120: /**
121: * Link true or false?
122: *
123: * @return link true or false?
124: */
125: public String getLink() {
126: if (link != null) {
127: return link;
128: } else {
129: return "";
130: }
131: }
132:
133: /**
134: * Link true or false?
135: *
136: * @param plink link true or false?
137: */
138: public void setLink(String plink) {
139: link = plink;
140: }
141:
142: /**
143: * Media Name.
144: *
145: * @return name
146: */
147: public String getName() {
148: return name;
149: }
150:
151: /**
152: * Media Name.
153: *
154: * @param pname name.
155: */
156: public void setName(String pname) {
157: name = pname;
158: }
159:
160: /**
161: * DOCUMENTATION PENDING
162: *
163: * @return DOCUMENTATION PENDING
164: */
165: public String getTitle() {
166: return title;
167: }
168:
169: /**
170: * DOCUMENTATION PENDING
171: *
172: * @param ptitle DOCUMENTATION PENDING
173: */
174: public void setTitle(String ptitle) {
175: title = ptitle;
176: }
177:
178: /**
179: * DOCUMENTATION PENDING
180: *
181: * @return DOCUMENTATION PENDING
182: */
183: public String getDescription() {
184: return description;
185: }
186:
187: /**
188: * DOCUMENTATION PENDING
189: *
190: * @param pdescription DOCUMENTATION PENDING
191: */
192: public void setDescription(String pdescription) {
193: description = pdescription;
194: }
195:
196: /**
197: * DOCUMENTATION PENDING
198: *
199: * @return DOCUMENTATION PENDING
200: */
201: public String getAuthor() {
202: return author;
203: }
204:
205: /**
206: * DOCUMENTATION PENDING
207: *
208: * @param pauthor DOCUMENTATION PENDING
209: */
210: public void setAuthor(String pauthor) {
211: author = pauthor;
212: }
213:
214: /**
215: * DOCUMENTATION PENDING
216: *
217: * @return DOCUMENTATION PENDING
218: */
219: public String getFileName() {
220: if (filename != null) {
221: return filename;
222: }
223:
224: if ((newfile != null) && (newfile.getFileName() != null)) {
225: return newfile.getFileName();
226: }
227:
228: return "";
229: }
230:
231: /**
232: * DOCUMENTATION PENDING
233: *
234: * @param pname DOCUMENTATION PENDING
235: */
236: public void setFileName(String pname) {
237: filename = pname;
238: }
239:
240: /**
241: * DOCUMENTATION PENDING
242: *
243: * @return DOCUMENTATION PENDING
244: */
245: public boolean getIsEdit() {
246: return isEdit;
247: }
248:
249: /**
250: * DOCUMENTATION PENDING
251: *
252: * @param pedit DOCUMENTATION PENDING
253: */
254: public void setIsEdit(boolean pedit) {
255: isEdit = pedit;
256: }
257:
258: /**
259: * DOCUMENTATION PENDING
260: *
261: * @return DOCUMENTATION PENDING
262: */
263: public String getType() {
264: return type;
265: }
266:
267: /**
268: * DOCUMENTATION PENDING
269: *
270: * @param ptype DOCUMENTATION PENDING
271: */
272: public void setType(String ptype) {
273: type = ptype;
274: }
275:
276: /**
277: * DOCUMENTATION PENDING
278: *
279: * @return DOCUMENTATION PENDING
280: */
281: public Collection getMediaTypes() {
282: return mediaTypes;
283: }
284:
285: /**
286: * DOCUMENTATION PENDING
287: *
288: * @param types DOCUMENTATION PENDING
289: */
290: public void setMediaTypes(Collection types) {
291: mediaTypes = types;
292: }
293:
294: /**
295: * DOCUMENTATION PENDING
296: *
297: * @return DOCUMENTATION PENDING
298: */
299: public String getMapId() {
300: return mapId;
301: }
302:
303: /**
304: * DOCUMENTATION PENDING
305: *
306: * @param pmapId DOCUMENTATION PENDING
307: */
308: public void setMapId(String pmapId) {
309: mapId = pmapId;
310: }
311:
312: /**
313: * Is this media item part of HTML code?
314: * @param pIsHtmlInline sets it true if it is, else false.
315: */
316: public void setIsHtmlInline(boolean pIsHtmlInline) {
317: isHtmlInline = pIsHtmlInline;
318: }
319:
320: /**
321: * Is this media item part of HTML code?
322: * @return true if it is, else false.
323: */
324: public boolean getIsHtmlInline() {
325: return isHtmlInline;
326: }
327:
328: /**
329: * If this media item part of HTML code, is it an image?
330: * This property is only relevant if isHtmlInline.
331: * @param pIsHtmlImage sets it true if it is, else false.
332: */
333: public void setIsHtmlImage(boolean pIsHtmlImage) {
334: isHtmlImage = pIsHtmlImage;
335: }
336:
337: /**
338: * If this media item part of HTML code, is it an image?
339: * This property is only relevant if isHtmlInline.
340: * @return true if it is, else false.
341: */
342: public boolean getIsHtmlImage() {
343: return isHtmlImage;
344: }
345:
346: /**
347: * If this media item part of an image HTML code
348: * the value set is an image ALT attribute.
349: * @param pimageAlt image ALT attribute.
350: */
351: public void setImageAlt(String pimageAlt) {
352: imageAlt = pimageAlt;
353: }
354:
355: /**
356: * If this media item part of an image HTML code
357: * the value is an image attribute.
358: * @return the value of the image attribute
359: */
360: public String getImageAlt() {
361: return imageAlt;
362: }
363:
364: /**
365: * If this media item part of an image HTML code
366: * the value is an image VSPACE attribute.
367: * @return the value of the image VSPACE attribute
368: */
369: public String getImageVspace() {
370: return imageVspace;
371: }
372:
373: /**
374: * If this media item part of an image HTML code
375: * the value is an image VSPACE attribute.
376: * @param pIsHtmlInline sets image VSPACE attribute.
377: */
378: public void setImageVspace(String pimageVspace) {
379: imageVspace = pimageVspace;
380: }
381:
382: /**
383: * If this media item part of an image HTML code
384: * the value of HSPACE image attribute.
385: * @return the value of the HSPACE image attribute
386: */
387: public String getImageHspace() {
388: return imageHspace;
389: }
390:
391: /**
392: * If this media item part of an image HTML code
393: * sets the value of HSPACE image attribute.
394: * @param pimageHspace value of HSPACE image attribute.
395: */
396: public void setImageHspace(String pimageHspace) {
397: imageHspace = pimageHspace;
398: }
399:
400: /**
401: * If this media item part of an image HTML code
402: * the value of ALIGN image attribute.
403: * @return the value of the ALIGN image attribute
404: */
405: public String getImageAlign() {
406: return imageAlign;
407: }
408:
409: /**
410: * If this media item part of an image HTML code
411: * sets the value of ALIGN image attribute.
412: * @param pimageHspace value of ALIGN image attribute.
413: */
414: public void setImageAlign(String pimageAlign) {
415: imageAlign = pimageAlign;
416: }
417:
418: /**
419: * If this media item part of an image HTML code
420: * the value of BORDER image attribute.
421: * @return the value of the BORDER image attribute
422: */
423: public String getImageBorder() {
424: return imageBorder;
425: }
426:
427: /**
428: * If this media item part of an image HTML code
429: * sets the value of BORDER image attribute.
430: * @param pimageHspace value of BORDER image attribute.
431: */
432: public void setImageBorder(String pimageBorder) {
433: imageBorder = pimageBorder;
434: }
435:
436: public String getItemIdentRef() {
437: if (itemIdentRef != null) {
438: return itemIdentRef;
439: } else {
440: return "";
441: }
442: }
443:
444: public void setItemIdentRef(String pitemIdentRef) {
445: itemIdentRef = pitemIdentRef;
446: }
447:
448: public String getUserName() {
449: return userName;
450: }
451:
452: public void setUserName(String puserName) {
453: userName = puserName;
454: }
455:
456: /**
457: * Sets defaults, used by constructor.
458: */
459: public void resetFields() {
460: if (source == null) {
461: source = "0";
462: newfile = null;
463: link = "";
464: name = "New media";
465: description = "";
466: author = "";
467: type = "text";
468: filename = "";
469: mediaTypes = new ArrayList();
470: mapId = "";
471: imageAlt = "New image";
472: imageVspace = "";
473: imageHspace = "";
474: imageAlign = "";
475: imageBorder = "";
476: isEdit = true;
477: isHtmlInline = true;
478: isHtmlImage = true;
479: itemIdentRef = "";
480: userName = "guest";
481: }
482: }
483: }
|