com.objectplanet.survey.plugin.api
Class HtmlUtils

java.lang.Object
  extended by com.objectplanet.survey.plugin.api.HtmlUtils

public class HtmlUtils
extends java.lang.Object

HTML utility class for the plugins. Produces HTML code for survey questions etc.

Author:
Torgeir Lund
Created:
24. march 2003

Constructor Summary
HtmlUtils()
           
 
Method Summary
static java.lang.String getDropdownInputName(int qNo)
          Gets the HTML input name for a dropdown input field for a question.
static java.lang.String getEssayInputName(int qNo, int index)
          Deprecated. use getIntextName((int qNo, int index)
static java.lang.String getFreeTextInputName(int qNo)
          Gets the HTML input name for a free text input field for a question.
static java.lang.String getIntextName(int qNo, int index)
          Gets the HTML input field name for an in-text element for a question at the specific index.
static java.lang.String getMatrixGroupIntersectionInputName(int qNo, int startX, int startY)
          Gets the HTML input name for a matrix group of type Intersection for a question.
static java.lang.String getMatrixGroupOnePerRowInputName(int qNo, int startX, int startY, int row)
          Gets the HTML input name for a matrix group of type OnePerRow for a question.
static java.lang.String getMatrixInputName(int qNo, int col, int row)
          Gets the HTML input name for a matrix input field for a certain cell in a matrix question.
static java.lang.String getMultipleInputName(int qNo, int index)
          Gets the HTML input name for a multiple input field for a question at a specific index, where more than one selections are allowed.
static java.lang.String getMultipleOneSelectionInputName(int qNo)
          Gets the HTML input name for a multiple input field for a question, where only one selection is allowed.
static java.lang.String getMultipleOtherInputName(int qNo)
          Gets the HTML input name for a multiple other input field for a question
static java.lang.String getNumericInputName(int qNo)
          Gets the HTML input name for a numeric input field for a question.
static java.lang.String getQuestionHTML(User user, long surveyId, int questionNo, javax.servlet.http.HttpServletRequest request)
          Gets the HTML code for a question.
static java.lang.String getQuestionHTML(User user, long surveyId, int questionNo, javax.servlet.http.HttpServletRequest request, PipingSource pipingSource)
          Gets the HTML code for a question.
static java.lang.String getRatingInputName(int qNo)
          Gets the html input name for a rating input field for a question.
static java.util.ArrayList getResponseList(User user, long surveyId, long respondentId, java.lang.String language)
          Gets a list of response html, each item in the list contains a label/value pair where label is question text(with essay responses) and value is html for a question response.
static java.lang.String getSingleResponse(User user, long surveyId, long respondentId, java.lang.String language)
          Gets a string representation of a single response
static java.lang.String htmlEncode(java.lang.String text)
          HTML Encodes a string.
static java.lang.String removeHTMLTags(java.lang.String orig)
          Returns a string without HTML tags in it.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlUtils

public HtmlUtils()
Method Detail

getQuestionHTML

public static java.lang.String getQuestionHTML(User user,
                                               long surveyId,
                                               int questionNo,
                                               javax.servlet.http.HttpServletRequest request)
                                        throws SurveySystemException,
                                               SurveySecurityException
Gets the HTML code for a question.

Parameters:
user - The user object
surveyId - Survey id
questionNo - Question number
request - The request object
Returns:
The questionHTML as string
Throws:
SurveySystemException - Description of the Exception
SurveySecurityException - Description of the Exception

getQuestionHTML

public static java.lang.String getQuestionHTML(User user,
                                               long surveyId,
                                               int questionNo,
                                               javax.servlet.http.HttpServletRequest request,
                                               PipingSource pipingSource)
                                        throws SurveySystemException,
                                               SurveySecurityException
Gets the HTML code for a question.

Parameters:
user - The user object
surveyId - Survey id
questionNo - Question number
request - The request object
Returns:
The questionHTML as string
Throws:
SurveySystemException - Description of the Exception
SurveySecurityException - Description of the Exception

getSingleResponse

public static java.lang.String getSingleResponse(User user,
                                                 long surveyId,
                                                 long respondentId,
                                                 java.lang.String language)
                                          throws SurveySystemException
Gets a string representation of a single response

Parameters:
user - The user object
surveyId - Survey id
respondentId - Respondent id
language - The selected language
Returns:
The singleResponse value
Throws:
SurveySystemException - Description of the Exception

getResponseList

public static java.util.ArrayList getResponseList(User user,
                                                  long surveyId,
                                                  long respondentId,
                                                  java.lang.String language)
                                           throws SurveySystemException
Gets a list of response html, each item in the list contains a label/value pair where label is question text(with essay responses) and value is html for a question response.

Parameters:
user - The user object
surveyId - Survey id
respondentId - Respondent id
language - The selected language
Returns:
a list of response html
Throws:
SurveySystemException

getEssayInputName

public static java.lang.String getEssayInputName(int qNo,
                                                 int index)
Deprecated. use getIntextName((int qNo, int index)

Gets the HTML input name for an essay input field for a question at the specific index.

Parameters:
qNo - Question number
index - The essay input field index
Returns:
The essayInputName value

getIntextName

public static java.lang.String getIntextName(int qNo,
                                             int index)
Gets the HTML input field name for an in-text element for a question at the specific index.

Parameters:
qNo - Question number
index - The in-text element index in the question
Returns:
The name of the input field for the in-text element

getRatingInputName

public static java.lang.String getRatingInputName(int qNo)
Gets the html input name for a rating input field for a question.

Parameters:
qNo - Question number
Returns:
The ratingInputName value

getMultipleOneSelectionInputName

public static java.lang.String getMultipleOneSelectionInputName(int qNo)
Gets the HTML input name for a multiple input field for a question, where only one selection is allowed.

Parameters:
qNo - Question number
Returns:
The multipleOneSelectionInputName value

getMultipleInputName

public static java.lang.String getMultipleInputName(int qNo,
                                                    int index)
Gets the HTML input name for a multiple input field for a question at a specific index, where more than one selections are allowed.

Parameters:
qNo - Question number
index - The multiple input field index
Returns:
The multipleInputName value

getMultipleOtherInputName

public static java.lang.String getMultipleOtherInputName(int qNo)
Gets the HTML input name for a multiple other input field for a question

Parameters:
qNo - Question number
Returns:
The multipleOtherInputName value

getNumericInputName

public static java.lang.String getNumericInputName(int qNo)
Gets the HTML input name for a numeric input field for a question.

Parameters:
qNo - Question number
Returns:
The numericInputName value

getDropdownInputName

public static java.lang.String getDropdownInputName(int qNo)
Gets the HTML input name for a dropdown input field for a question.

Parameters:
qNo - Question number
Returns:
The dropdownInputName value

getMatrixInputName

public static java.lang.String getMatrixInputName(int qNo,
                                                  int col,
                                                  int row)
Gets the HTML input name for a matrix input field for a certain cell in a matrix question.

Parameters:
qNo - Question number
col - The column number
row - The row number
Returns:
The matrixInputName value

getMatrixGroupIntersectionInputName

public static java.lang.String getMatrixGroupIntersectionInputName(int qNo,
                                                                   int startX,
                                                                   int startY)
Gets the HTML input name for a matrix group of type Intersection for a question.

Parameters:
qNo - Question number
startX - The matrix group's startY value
startY - The matrix group's startY value
Returns:
The matrixGroupIntersectionInputName value

getMatrixGroupOnePerRowInputName

public static java.lang.String getMatrixGroupOnePerRowInputName(int qNo,
                                                                int startX,
                                                                int startY,
                                                                int row)
Gets the HTML input name for a matrix group of type OnePerRow for a question.

Parameters:
qNo - Question number
startX - The matrix group's startY value
startY - The matrix group's startY value
row - The row number
Returns:
The matrixGroupOnePerRowInputName value

getFreeTextInputName

public static java.lang.String getFreeTextInputName(int qNo)
Gets the HTML input name for a free text input field for a question.

Parameters:
qNo - Question number
Returns:
The freeTextInputName value

htmlEncode

public static java.lang.String htmlEncode(java.lang.String text)
HTML Encodes a string.

Parameters:
value - text to be encoded
Returns:
possibly modified encoded text

removeHTMLTags

public static java.lang.String removeHTMLTags(java.lang.String orig)
Returns a string without HTML tags in it.

Parameters:
orig - the original string
Returns:
string without HTML tags

Copyright ? ObjectPlanet Inc. All Rights Reserved.

Built on December 20 2016