Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java =================================================================== diff -u -r58c329ba6a678db2ff9c89dc782765f1aeea0d1e -re4d5148174b5ef9fa8a12f12af430afadc80e435 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java (.../VoteUtils.java) (revision 58c329ba6a678db2ff9c89dc782765f1aeea0d1e) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java (.../VoteUtils.java) (revision e4d5148174b5ef9fa8a12f12af430afadc80e435) @@ -252,7 +252,7 @@ { if (!htmlTokens[i].trim().equals("")) { - noHtmlNoNewLineStr= noHtmlNoNewLineStr + " " + htmlTokens[i]; + noHtmlNoNewLineStr = noHtmlNoNewLineStr.length() > 0 ? noHtmlNoNewLineStr + " " + htmlTokens[i] : htmlTokens[i]; } } @@ -266,8 +266,17 @@ index = htmlText.indexOf("\"",index); if ( index > -1 && index < htmlText.length()) { int indexStop = htmlText.indexOf("\"", index+1); - if ( indexStop > -1) - return htmlText.substring(index+1, indexStop-1); + if ( indexStop > -1) { + String srcEntry = htmlText.substring(index+1, indexStop); + // get rid of any leading path and just get the filename; + index = srcEntry.lastIndexOf("/"); + if ( index == srcEntry.length()-1 ) + index = srcEntry.lastIndexOf("/", index); + if ( index > -1 ) { + srcEntry = srcEntry.substring(index+1); + } + return srcEntry; + } } } if (htmlText.length() > 50) Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteOutputFactory.java =================================================================== diff -u -rca9bfb3f1b523e53197504a9e9d741185d27220c -re4d5148174b5ef9fa8a12f12af430afadc80e435 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteOutputFactory.java (.../VoteOutputFactory.java) (revision ca9bfb3f1b523e53197504a9e9d741185d27220c) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteOutputFactory.java (.../VoteOutputFactory.java) (revision e4d5148174b5ef9fa8a12f12af430afadc80e435) @@ -59,8 +59,6 @@ if ( content.getMaxNominationCount() != null && ! content.getMaxNominationCount().equals("1") ) { log.error("Unable to build output definitions for Voting if the user can have more than one nomination. Vote "+content); - } else if ( content.isAllowText() ) { - log.error("Unable to build output definitions for Voting if the user can enter free text. Vote "+content); } else { ToolOutputDefinition definition = buildLongOutputDefinition(OUTPUT_NAME_NOMINATION_SELECTION); @@ -71,6 +69,17 @@ int min = 1; int max = 1; + + if ( content.isAllowText() ) { + min = 0; + defaultConditions.add(new BranchCondition(null, null, new Integer(0), OUTPUT_NAME_NOMINATION_SELECTION, + getI18NText("label.open.vote", false), + OutputType.OUTPUT_LONG.toString(), + "0", + "0", + null)); + } + Iterator iter = content.getVoteQueContents().iterator(); while ( iter.hasNext() ) { VoteQueContent nomination = (VoteQueContent) iter.next(); @@ -136,11 +145,13 @@ Iterator iter = voteAttempts.iterator(); while ( iter.hasNext() ) { - VoteUsrAttempt attempt = (VoteUsrAttempt) iter.next(); - // VoteQueContentId == 1 indicates that it is a free text entry - if ( attempt.getVoteQueContentId().longValue() != 1) { + VoteUsrAttempt attempt = (VoteUsrAttempt) iter.next(); + if ( attempt.getVoteQueContentId().longValue() == 1 ) { + // VoteQueContentId == 1 indicates that it is a free text entry + return new ToolOutput(OUTPUT_NAME_NOMINATION_SELECTION, getI18NText(OUTPUT_NAME_NOMINATION_SELECTION, true), new Long(0)); + } else { VoteQueContent nomination = attempt.getVoteQueContent(); - return new ToolOutput(OUTPUT_NAME_NOMINATION_SELECTION, getDescription(OUTPUT_NAME_NOMINATION_SELECTION), new Long(nomination.getDisplayOrder())); + return new ToolOutput(OUTPUT_NAME_NOMINATION_SELECTION, getI18NText(OUTPUT_NAME_NOMINATION_SELECTION, true), new Long(nomination.getDisplayOrder())); } } }