/** * Escape HTML-formatted text in preparation to include it in an HTML document. * * @param value * The string to escape. * @return value escaped for HTML. * @deprecated this is a passthrough for {@link FormattedText#escapeHtmlFormattedText(String)} so use that instead */ public static String escapeHtmlFormattedText(String value) { return FormattedText.escapeHtmlFormattedText(value); }
/** * Escape HTML-formatted text in preparation to include it in an HTML document. * @deprecated this is a passthrough for {@link FormattedText#escapeHtmlFormattedText(String)} so use that instead */ public static String escapeHtmlFormattedText(String value) { return FormattedText.escapeHtmlFormattedText(value); }
/** * Access the formatted text part of the instructors feedback; usually an annotated copy of the submittedText * * @return The formatted text of the grader's feedback. */ public String getFeedbackFormattedText() { if (m_feedbackText == null || m_feedbackText.length() == 0) return m_feedbackText; String value = fixAssignmentFeedback(m_feedbackText); StringBuffer buf = new StringBuffer(value); int pos = -1; while ((pos = buf.indexOf("{{")) != -1) { buf.replace(pos, pos + "{{".length(), "<span class='highlight'>"); } while ((pos = buf.indexOf("}}")) != -1) { buf.replace(pos, pos + "}}".length(), "</span>"); } return FormattedText.escapeHtmlFormattedText(buf.toString()); }
public String getDisplayNameForTheUser(String userId) { try { User sakaiUser = userDirectoryService.getUser(userId); return FormattedText.escapeHtmlFormattedText(sakaiUser.getDisplayName()); } catch (Exception e) { return userId; // this can happen if the user does not longer exist // in the system } }
public static void setErrorMessage(PortletRequest request, String errorMsg, Throwable t) { if ( errorMsg == null ) errorMsg = "null"; PortletSession pSession = request.getPortletSession(true); pSession.setAttribute("error.message",errorMsg); OutputStream oStream = new ByteArrayOutputStream(); PrintStream pStream = new PrintStream(oStream); log.error("{}", oStream); log.error("{}", pStream); // errorMsg = errorMsg .replaceAll("<","<").replaceAll(">",">"); StringBuffer errorOut = new StringBuffer(); errorOut.append("<p class=\"portlet-msg-error\">\n"); errorOut.append(FormattedText.escapeHtmlFormattedText(errorMsg)); errorOut.append("\n</p>\n<!-- Traceback for this error\n"); errorOut.append(oStream.toString()); errorOut.append("\n-->\n"); pSession.setAttribute("error.output",errorOut.toString()); Map map = request.getParameterMap(); pSession.setAttribute("error.map",map); }
public static void setErrorMessage(PortletRequest request, String errorMsg, Throwable t) { if ( errorMsg == null ) errorMsg = "null"; PortletSession pSession = request.getPortletSession(true); pSession.setAttribute("error.message",errorMsg); OutputStream oStream = new ByteArrayOutputStream(); PrintStream pStream = new PrintStream(oStream); log.error("{}", oStream); log.error("{}", pStream); // errorMsg = errorMsg .replaceAll("<","<").replaceAll(">",">"); StringBuffer errorOut = new StringBuffer(); errorOut.append("<p class=\"portlet-msg-error\">\n"); errorOut.append(FormattedText.escapeHtmlFormattedText(errorMsg)); errorOut.append("\n</p>\n<!-- Traceback for this error\n"); errorOut.append(oStream.toString()); errorOut.append("\n-->\n"); pSession.setAttribute("error.output",errorOut.toString()); Map map = request.getParameterMap(); pSession.setAttribute("error.map",map); }