1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.taglib.ui;
16  
17  import com.liferay.taglib.util.IncludeTag;
18  
19  import javax.servlet.http.HttpServletRequest;
20  
21  /**
22   * <a href="DiscussionTag.java.html"><b><i>View Source</i></b></a>
23   *
24   * @author Charles May
25   */
26  public class DiscussionTag extends IncludeTag {
27  
28      public int doStartTag() {
29          HttpServletRequest request =
30              (HttpServletRequest)pageContext.getRequest();
31  
32          request.setAttribute("liferay-ui:discussion:className", _className);
33          request.setAttribute(
34              "liferay-ui:discussion:classPK", String.valueOf(_classPK));
35          request.setAttribute("liferay-ui:discussion:formAction", _formAction);
36          request.setAttribute("liferay-ui:discussion:formName", _formName);
37          request.setAttribute(
38              "liferay-ui:discussion:ratingsEnabled",
39              String.valueOf(_ratingsEnabled));
40          request.setAttribute("liferay-ui:discussion:redirect", _redirect);
41          request.setAttribute("liferay-ui:discussion:subject", _subject);
42          request.setAttribute(
43              "liferay-ui:discussion:userId", String.valueOf(_userId));
44  
45          return EVAL_BODY_BUFFERED;
46      }
47  
48      public void setClassName(String className) {
49          _className = className;
50      }
51  
52      public void setClassPK(long classPK) {
53          _classPK = classPK;
54      }
55  
56      public void setFormAction(String formAction) {
57          _formAction = formAction;
58      }
59  
60      public void setFormName(String formName) {
61          _formName = formName;
62      }
63  
64      public void setRatingsEnabled(boolean ratingsEnabled) {
65          _ratingsEnabled = ratingsEnabled;
66      }
67  
68      public void setRedirect(String redirect) {
69          _redirect = redirect;
70      }
71  
72      public void setSubject(String subject) {
73          _subject = subject;
74      }
75  
76      public void setUserId(long userId) {
77          _userId = userId;
78      }
79  
80      protected String getDefaultPage() {
81          return _PAGE;
82      }
83  
84      private static final String _PAGE = "/html/taglib/ui/discussion/page.jsp";
85  
86      private String _className;
87      private long _classPK;
88      private String _formAction;
89      private String _formName = "fm";
90      private boolean _ratingsEnabled = true;
91      private String _redirect;
92      private String _subject;
93      private long _userId;
94  
95  }