Index: lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteQueContent.hbm.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/Attic/VoteQueContent.hbm.xml,v
diff -u -r1.3 -r1.4
--- lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteQueContent.hbm.xml 20 Apr 2006 16:09:29 -0000 1.3
+++ lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteQueContent.hbm.xml 23 Apr 2006 20:10:46 -0000 1.4
@@ -39,6 +39,7 @@
>
+
+
+
+
+
+
+
The following is a summary of your answers.
+label.learning.forceFinishMessage =You have reached the maximum number of nominations for this activity. Please finish.
count.total.user =Total Users Count:
count.finished.user =Finished User Count:
count.max.attempt =Maximum Attempt Count:
@@ -59,6 +60,7 @@
label.retake =Retake
label.view.summary =View Summary
label.view.answers =View Answers
+label.view.answers =View Nominations
label.view =View
label.download =Download
label.delete =Delete
@@ -160,6 +162,7 @@
error.noLearnerActivity =Summary report is not available since no users attempted the activity yet.
#Learning mode resources
+label.progressiveResults =Progressive Results
label.question =Question
label.answers =Answers:
button.endLearning =Finish
@@ -171,7 +174,7 @@
label.attemptTime =Attempt Date/Time
label.timezone =Time-Zone
label.response =Response
-label.learning.forceOfflineMessage =This is setup to be carried out offline. Plase see your instructor for details.
+label.learning.forceOfflineMessage =This is an offline activity. Please see your instructor for details.
label.learning.runOffline =This activity is not being done on the computer. Please see your instructor for details.
error.defineLater =Sorry, the activity's content is not ready yet. Please wait for the teacher to define this part.
error.toolSessionId.required =Tool Activity Error! Can't continue
URL is not complete. The Tool Activity requires a toolSession id.
Index: lams_tool_vote/db/model/lams_tool_vote.clay
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/db/model/lams_tool_vote.clay,v
diff -u -r1.5 -r1.6
--- lams_tool_vote/db/model/lams_tool_vote.clay 22 Apr 2006 11:33:16 -0000 1.5
+++ lams_tool_vote/db/model/lams_tool_vote.clay 23 Apr 2006 20:10:47 -0000 1.6
@@ -449,7 +449,7 @@
-
+
@@ -503,18 +503,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
Index: lams_tool_vote/db/sql/create_lams_tool_vote.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/db/sql/create_lams_tool_vote.sql,v
diff -u -r1.7 -r1.8
--- lams_tool_vote/db/sql/create_lams_tool_vote.sql 22 Apr 2006 11:33:16 -0000 1.7
+++ lams_tool_vote/db/sql/create_lams_tool_vote.sql 23 Apr 2006 20:10:44 -0000 1.8
@@ -66,8 +66,9 @@
, vote_que_content_id BIGINT(20) NOT NULL
, attempt_time DATETIME
, time_zone VARCHAR(255)
+ , nominationCount INT(5) NOT NULL DEFAULT 0
, userEntry VARCHAR(255)
- , isNominated TINYINT NOT NULL DEFAULT 0
+ , singleUserEntry TINYINT(1) NOT NULL DEFAULT 0
, PRIMARY KEY (uid)
, INDEX (que_usr_id)
, CONSTRAINT FK_tl_vote_usr_attempt_1 FOREIGN KEY (que_usr_id)
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java,v
diff -u -r1.8 -r1.9
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java 20 Apr 2006 16:09:29 -0000 1.8
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java 23 Apr 2006 20:10:47 -0000 1.9
@@ -44,10 +44,12 @@
public static final String LEARNING_STARTER ="learningStarter";
public static final String MONITORING_STARTER ="monitoringStarter";
public static final String LOAD_LEARNER ="loadLearner";
+ public static final String ALL_NOMINATIONS ="allNominations";
public static final String LOAD_MONITORING_CONTENT ="loadMonitoring";
public static final String LOAD_MONITORING_CONTENT_EDITACTIVITY ="loadMonitoringEditActivity";
public static final String EXPORT_PORTFOLIO = "exportPortfolio";
public static final String INDIVIDUAL_REPORT ="individualReport";
+ public static final String EXIT_PAGE ="exitPage";
public static final String VIEW_SUMMARY ="viewSummary";
public static final String REDO_QUESTIONS ="redoQuestions";
public static final String SINGLE_QUESTION_ANSWERS ="singleQuestionAnswers";
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java,v
diff -u -r1.3 -r1.4
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java 13 Apr 2006 18:30:38 -0000 1.3
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java 23 Apr 2006 20:10:47 -0000 1.4
@@ -41,8 +41,14 @@
public List getAttemptsForUser(final Long queUsrId);
- public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId);
+ public void removeAttemptsForUser(final Long queUsrId);
+ public int getLastNominationCount(Long userId);
+
+ public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId);
+
+ public List getAttemptsListForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId);
+
public List getAttemptForQueContent(final Long queUsrId, final Long voteQueContentId);
public void updateVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt);
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUserDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUserDAO.java,v
diff -u -r1.4 -r1.5
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUserDAO.java 20 Apr 2006 12:24:29 -0000 1.4
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUserDAO.java 23 Apr 2006 20:10:45 -0000 1.5
@@ -25,6 +25,7 @@
import java.util.List;
import org.hibernate.FlushMode;
+import org.lamsfoundation.lams.tool.vote.VoteApplicationException;
import org.lamsfoundation.lams.tool.vote.dao.IVoteUserDAO;
import org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr;
import org.lamsfoundation.lams.tool.vote.pojos.VoteSession;
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java,v
diff -u -r1.3 -r1.4
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java 13 Apr 2006 18:30:38 -0000 1.3
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java 23 Apr 2006 20:10:45 -0000 1.4
@@ -22,11 +22,13 @@
package org.lamsfoundation.lams.tool.vote.dao.hibernate;
+import java.util.Iterator;
import java.util.List;
import org.apache.log4j.Logger;
import org.hibernate.FlushMode;
import org.lamsfoundation.lams.tool.vote.dao.IVoteUsrAttemptDAO;
+import org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent;
import org.lamsfoundation.lams.tool.vote.pojos.VoteUsrAttempt;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
@@ -70,18 +72,70 @@
return list;
}
- public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId)
+ public void removeAttemptsForUser(final Long queUsrId)
{
HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER)
+ .setLong("queUsrId", queUsrId.longValue())
+ .list();
+
+ if(list != null && list.size() > 0){
+ Iterator listIterator=list.iterator();
+ while (listIterator.hasNext())
+ {
+ VoteUsrAttempt attempt=(VoteUsrAttempt)listIterator.next();
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ templ.delete(attempt);
+ templ.flush();
+ }
+ }
+ }
+
+
+ public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId)
+ {
+ HibernateTemplate templ = this.getHibernateTemplate();
List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT)
.setLong("queUsrId", queUsrId.longValue())
.setLong("voteQueContentId", voteQueContentId.longValue())
.list();
- return list;
+ if(list != null && list.size() > 0){
+ VoteUsrAttempt voteA = (VoteUsrAttempt) list.get(0);
+ return voteA;
+ }
+
+ return null;
}
+
+ public List getAttemptsListForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId)
+ {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT)
+ .setLong("queUsrId", queUsrId.longValue())
+ .setLong("voteQueContentId", voteQueContentId.longValue())
+ .list();
+ return list;
+ }
+
+ public int getLastNominationCount(Long userId)
+ {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER)
+ .setLong("queUsrId", userId.longValue())
+ .list();
+
+
+ if(list != null && list.size() > 0){
+ VoteUsrAttempt vote = (VoteUsrAttempt) list.get(0);
+ return vote.getNominationCount();
+ }
+ return 0;
+ }
+
+
public List getAttemptForQueContent(final Long queUsrId, final Long voteQueContentId)
{
HibernateTemplate templ = this.getHibernateTemplate();
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUsrAttempt.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUsrAttempt.java,v
diff -u -r1.5 -r1.6
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUsrAttempt.java 22 Apr 2006 14:01:19 -0000 1.5
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUsrAttempt.java 23 Apr 2006 20:10:46 -0000 1.6
@@ -52,8 +52,12 @@
private String userEntry;
+ private int nominationCount;
+
private Long queUsrId;
+ private boolean singleUserEntry;
+
private Long voteQueContentId;
/** persistent field */
@@ -92,7 +96,29 @@
this.userEntry=userEntry;
}
+ public VoteUsrAttempt(Date attemptTime, String timeZone, org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent voteQueContent,
+ org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr voteQueUsr, String userEntry, int nominationCount) {
+ this.attemptTime = attemptTime;
+ this.timeZone = timeZone;
+ this.voteQueContent = voteQueContent;
+ this.voteQueUsr = voteQueUsr;
+ this.userEntry=userEntry;
+ this.nominationCount=nominationCount;
+ }
+
+ public VoteUsrAttempt(Date attemptTime, String timeZone, org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent voteQueContent,
+ org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr voteQueUsr, String userEntry, int nominationCount, boolean singleUserEntry) {
+ this.attemptTime = attemptTime;
+ this.timeZone = timeZone;
+ this.voteQueContent = voteQueContent;
+ this.voteQueUsr = voteQueUsr;
+ this.userEntry=userEntry;
+ this.nominationCount=nominationCount;
+ this.singleUserEntry=singleUserEntry;
+ }
+
+
public VoteUsrAttempt(String userEntry, Date attemptTime, String timeZone, org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent voteQueContent,
org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr voteQueUsr) {
@@ -231,4 +257,30 @@
this.userEntry = userEntry;
}
+ /**
+ * @return Returns the nominationCount.
+ */
+ public int getNominationCount() {
+ return nominationCount;
+ }
+ /**
+ * @param nominationCount The nominationCount to set.
+ */
+ public void setNominationCount(int nominationCount) {
+ this.nominationCount = nominationCount;
+ }
+
+ /**
+ * @return Returns the singleUserEntry.
+ */
+ public boolean isSingleUserEntry() {
+ return singleUserEntry;
+ }
+ /**
+ * @param singleUserEntry The singleUserEntry to set.
+ */
+ public void setSingleUserEntry(boolean singleUserEntry) {
+ this.singleUserEntry = singleUserEntry;
+ }
+
}
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java,v
diff -u -r1.6 -r1.7
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java 21 Apr 2006 14:50:28 -0000 1.6
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java 23 Apr 2006 20:10:46 -0000 1.7
@@ -68,6 +68,10 @@
public VoteQueUsr retrieveVoteQueUsr(Long userId) throws VoteApplicationException;
public VoteQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long voteContentUid) throws VoteApplicationException;
+
+ public List getAttemptsListForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException;
+
+ public int getLastNominationCount(Long userId) throws VoteApplicationException;
public void createVoteUsrAttempt(VoteUsrAttempt mcUsrAttempt) throws VoteApplicationException;
@@ -77,7 +81,7 @@
public void updateVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException;
- public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long mcQueContentId) throws VoteApplicationException;
+ public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException;
public List retrieveVoteQueContentsByToolContentId(long qaContentId) throws VoteApplicationException;
@@ -105,6 +109,8 @@
public VoteQueUsr getVoteUserByUID(Long uid) throws VoteApplicationException;
+ public void removeAttemptsForUser(final Long queUsrId) throws VoteApplicationException;
+
public List getAllQuestionEntries(final Long mcContentId) throws VoteApplicationException;
public VoteQueUsr getVoteQueUsrById(long voteQueUsrId) throws VoteApplicationException;
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java,v
diff -u -r1.6 -r1.7
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java 21 Apr 2006 14:50:28 -0000 1.6
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java 23 Apr 2006 20:10:45 -0000 1.7
@@ -52,8 +52,6 @@
import org.lamsfoundation.lams.tool.exception.DataMissingException;
import org.lamsfoundation.lams.tool.exception.SessionDataExistsException;
import org.lamsfoundation.lams.tool.exception.ToolException;
-import org.lamsfoundation.lams.tool.vote.VoteApplicationException;
-import org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent;
import org.lamsfoundation.lams.tool.service.ILamsToolService;
import org.lamsfoundation.lams.tool.vote.VoteAppConstants;
import org.lamsfoundation.lams.tool.vote.VoteApplicationException;
@@ -191,7 +189,6 @@
}
}
-
public VoteQueUsr getVoteQueUsrById(long voteQueUsrId) throws VoteApplicationException
{
try
@@ -429,8 +426,22 @@
}
}
+ public void removeAttemptsForUser(final Long queUsrId) throws VoteApplicationException
+ {
+ try
+ {
+ voteUsrAttemptDAO.removeAttemptsForUser(queUsrId);
+ }
+ catch (DataAccessException e)
+ {
+ throw new VoteApplicationException("Exception occured when lams is removing voteUsrAttempts: "
+ + e.getMessage(),
+ e);
+ }
+ }
- public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException
+
+ public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException
{
try
{
@@ -444,6 +455,22 @@
}
}
+
+ public List getAttemptsListForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException
+ {
+ try
+ {
+ return voteUsrAttemptDAO.getAttemptsListForUserAndQuestionContent(queUsrId, voteQueContentId);
+ }
+ catch (DataAccessException e)
+ {
+ throw new VoteApplicationException("Exception occured when lams is getting vote UsrAttempt by user id and que content id: "
+ + e.getMessage(),
+ e);
+ }
+
+ }
+
public void updateVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException
{
@@ -782,7 +809,23 @@
}
}
+ public int getLastNominationCount(Long userId) throws VoteApplicationException
+ {
+ try
+ {
+ int lastNomCount=voteUsrAttemptDAO.getLastNominationCount(userId);
+ return lastNomCount;
+ }
+ catch (DataAccessException e)
+ {
+ throw new VoteApplicationException("Exception occured when lams is retrieving lastNominationount: "
+ + e.getMessage(),
+ e);
+ }
+ }
+
+
public void deleteVoteQueUsr(VoteQueUsr voteQueUsr) throws VoteApplicationException
{
try
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/LearningUtil.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/Attic/LearningUtil.java,v
diff -u -r1.5 -r1.6
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/LearningUtil.java 22 Apr 2006 14:01:19 -0000 1.5
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/LearningUtil.java 23 Apr 2006 20:10:45 -0000 1.6
@@ -129,11 +129,12 @@
}
- public static void createAttempt(HttpServletRequest request, VoteQueUsr voteQueUsr, Map mapGeneralCheckedOptionsContent, String userEntry)
+ public static void createAttempt(HttpServletRequest request, VoteQueUsr voteQueUsr, Map mapGeneralCheckedOptionsContent, String userEntry, int nominationCount, boolean singleUserEntry)
{
logger.debug("doing createAttempt: " + mapGeneralCheckedOptionsContent);
-
+ logger.debug("nominationCount: " + nominationCount);
logger.debug("userEntry: " + userEntry);
+ logger.debug("singleUserEntry: " + singleUserEntry);
IVoteService voteService =VoteUtils.getToolService(request);
Date attempTime=VoteUtils.getGMTDateTime();
@@ -153,32 +154,60 @@
logger.debug("questionDisplayOrder: " + questionDisplayOrder);
-
VoteQueContent voteQueContent=voteService.getQuestionContentByDisplayOrder(questionDisplayOrder, toolContentUID);
logger.debug("voteQueContent: " + voteQueContent);
if (voteQueContent != null)
{
- createIndividualOptions(request, voteQueContent, voteQueUsr, attempTime, timeZone, userEntry);
+ createIndividualOptions(request, voteQueContent, voteQueUsr, attempTime, timeZone, userEntry, nominationCount, false);
}
+ else if ((voteQueContent == null) && (questionDisplayOrder.toString().equals("101")))
+ {
+ logger.debug("creating user entry record");
+ VoteQueContent localVoteQueContent=voteService.getToolDefaultQuestionContent(1);
+ logger.debug("localVoteQueContent: " + localVoteQueContent);
+ createIndividualOptions(request, localVoteQueContent, voteQueUsr, attempTime, timeZone, userEntry, nominationCount, true);
+ }
+
}
}
}
- public static void createIndividualOptions(HttpServletRequest request, VoteQueContent voteQueContent, VoteQueUsr voteQueUsr, Date attempTime, String timeZone, String userEntry)
+ public static void createIndividualOptions(HttpServletRequest request, VoteQueContent voteQueContent, VoteQueUsr voteQueUsr, Date attempTime, String timeZone, String userEntry, int nominationCount, boolean singleUserEntry)
{
logger.debug("doing createIndividualOptions");
-
+ logger.debug("nominationCount: " + nominationCount);
logger.debug("userEntry: " + userEntry);
+ logger.debug("singleUserEntry: " + singleUserEntry);
IVoteService voteService =VoteUtils.getToolService(request);
logger.debug("voteQueContent: " + voteQueContent);
+ logger.debug("user " + voteQueUsr.getQueUsrId());
+ logger.debug("voteQueContent.getVoteContentId() " +voteQueContent.getVoteContentId());
+
if (voteQueContent != null)
{
- VoteUsrAttempt voteUsrAttempt=new VoteUsrAttempt(attempTime, timeZone, voteQueContent, voteQueUsr, userEntry);
+ VoteUsrAttempt existingVoteUsrAttempt=voteService.getAttemptsForUserAndQuestionContent(voteQueUsr.getQueUsrId(),voteQueContent.getVoteContentId());
+ logger.debug("existingVoteUsrAttempt: " + existingVoteUsrAttempt);
+
+ if (existingVoteUsrAttempt != null)
+ {
+ logger.debug("update existingVoteUsrAttempt: " + existingVoteUsrAttempt);
+ existingVoteUsrAttempt.setNominationCount(nominationCount);
+ existingVoteUsrAttempt.setUserEntry(userEntry);
+ existingVoteUsrAttempt.setAttemptTime(attempTime);
+ existingVoteUsrAttempt.setTimeZone(timeZone);
+ voteService.updateVoteUsrAttempt(existingVoteUsrAttempt);
+ logger.debug("done updating existingVoteUsrAttempt: " + existingVoteUsrAttempt);
+ }
+ else
+ {
+ logger.debug("create new attempt");
+ VoteUsrAttempt voteUsrAttempt=new VoteUsrAttempt(attempTime, timeZone, voteQueContent, voteQueUsr, userEntry, nominationCount , singleUserEntry);
logger.debug("voteUsrAttempt: " + voteUsrAttempt);
voteService.createVoteUsrAttempt(voteUsrAttempt);
logger.debug("created voteUsrAttempt in the db :" + voteUsrAttempt);
+ }
}
}
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java,v
diff -u -r1.3 -r1.4
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java 20 Apr 2006 12:24:29 -0000 1.3
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java 23 Apr 2006 20:10:45 -0000 1.4
@@ -233,7 +233,7 @@
if (voteQueUsr != null)
{
logger.debug("getting listUserAttempts for user id: " + voteQueUsr.getUid() + " and que content id: " + questionUid);
- List listUserAttempts=voteService.getAttemptsForUserAndQuestionContent(voteQueUsr.getUid(), new Long(questionUid));
+ List listUserAttempts=voteService.getAttemptsListForUserAndQuestionContent(voteQueUsr.getUid(), new Long(questionUid));
logger.debug("listUserAttempts: " + listUserAttempts);
Iterator itAttempts=listUserAttempts.iterator();
@@ -276,7 +276,7 @@
if (voteQueUsr != null)
{
logger.debug("getting listUserAttempts for user id: " + voteQueUsr.getUid() + " and que content id: " + questionUid);
- List listUserAttempts=voteService.getAttemptsForUserAndQuestionContent(voteQueUsr.getUid(), new Long(questionUid));
+ List listUserAttempts=voteService.getAttemptsListForUserAndQuestionContent(voteQueUsr.getUid(), new Long(questionUid));
logger.debug("listUserAttempts: " + listUserAttempts);
Iterator itAttempts=listUserAttempts.iterator();
@@ -318,7 +318,7 @@
if (voteQueUsr != null)
{
logger.debug("getting listUserAttempts for user id: " + voteQueUsr.getUid() + " and que content id: " + questionUid);
- List listUserAttempts=voteService.getAttemptsForUserAndQuestionContent(voteQueUsr.getUid(), new Long(questionUid));
+ List listUserAttempts=voteService.getAttemptsListForUserAndQuestionContent(voteQueUsr.getUid(), new Long(questionUid));
logger.debug("listUserAttempts: " + listUserAttempts);
Iterator itAttempts=listUserAttempts.iterator();
@@ -368,7 +368,7 @@
if (voteQueUsr != null)
{
logger.debug("getting listUserAttempts for user id: " + voteQueUsr.getUid() + " and que content id: " + questionUid);
- List listUserAttempts=voteService.getAttemptsForUserAndQuestionContent(voteQueUsr.getUid(), new Long(questionUid));
+ List listUserAttempts=voteService.getAttemptsListForUserAndQuestionContent(voteQueUsr.getUid(), new Long(questionUid));
logger.debug("listUserAttempts: " + listUserAttempts);
Iterator itAttempts=listUserAttempts.iterator();
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java,v
diff -u -r1.5 -r1.6
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java 22 Apr 2006 14:01:19 -0000 1.5
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java 23 Apr 2006 20:10:45 -0000 1.6
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.util.Map;
+import java.util.TreeMap;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -40,6 +41,7 @@
import org.lamsfoundation.lams.tool.exception.ToolException;
import org.lamsfoundation.lams.tool.vote.VoteAppConstants;
import org.lamsfoundation.lams.tool.vote.VoteApplicationException;
+import org.lamsfoundation.lams.tool.vote.VoteComparator;
import org.lamsfoundation.lams.tool.vote.VoteUtils;
import org.lamsfoundation.lams.tool.vote.pojos.VoteContent;
import org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr;
@@ -127,6 +129,24 @@
VoteLearningForm voteLearningForm = (VoteLearningForm) form;
IVoteService voteService =VoteUtils.getToolService(request);
+ voteLearningForm.resetCommands();
+ return (mapping.findForward(ALL_NOMINATIONS));
+ }
+
+
+ public ActionForward viewAnswers(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ VoteUtils.cleanUpUserExceptions(request);
+ logger.debug("dispatching viewAnswers...");
+
+ setContentInUse(request);
+ VoteLearningForm voteLearningForm = (VoteLearningForm) form;
+ IVoteService voteService =VoteUtils.getToolService(request);
+
Long toolContentId=(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
logger.debug("toolContentId: " + toolContentId);
@@ -135,8 +155,85 @@
return (mapping.findForward(INDIVIDUAL_REPORT));
}
+
+ public ActionForward redoQuestionsOk(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ VoteUtils.cleanUpUserExceptions(request);
+ logger.debug("dispatching redoQuestionsOk...");
+
+ VoteLearningForm voteLearningForm = (VoteLearningForm) form;
+ IVoteService voteService =VoteUtils.getToolService(request);
+
+
+ setContentInUse(request);
+ logger.debug("requested redoQuestionsOk, user is sure to redo the questions.");
+ voteLearningForm.resetCommands();
+ return redoQuestions(mapping, form, request, response);
+ }
+
+ public ActionForward learnerFinished(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ logger.debug("dispatching learnerFinished");
+ logger.debug("requested learner finished, the learner should be directed to next activity.");
+
+ VoteLearningForm voteLearningForm = (VoteLearningForm) form;
+ IVoteService voteService =VoteUtils.getToolService(request);
+
+ Long toolSessionId = (Long) request.getSession().getAttribute(TOOL_SESSION_ID);
+ String userID=(String) request.getSession().getAttribute(USER_ID);
+ logger.debug("attempting to leave/complete session with toolSessionId:" + toolSessionId + " and userID:"+userID);
+
+ VoteUtils.cleanUpSessionAbsolute(request);
+
+ String nextUrl=null;
+ try
+ {
+ nextUrl=voteService.leaveToolSession(toolSessionId, new Long(userID));
+ logger.debug("nextUrl: "+ nextUrl);
+ }
+ catch (DataMissingException e)
+ {
+ logger.debug("failure getting nextUrl: "+ e);
+ voteLearningForm.resetCommands();
+ //throw new ServletException(e);
+ return (mapping.findForward(LEARNING_STARTER));
+ }
+ catch (ToolException e)
+ {
+ logger.debug("failure getting nextUrl: "+ e);
+ voteLearningForm.resetCommands();
+ //throw new ServletException(e);
+ return (mapping.findForward(LEARNING_STARTER));
+ }
+ catch (Exception e)
+ {
+ logger.debug("unknown exception getting nextUrl: "+ e);
+ voteLearningForm.resetCommands();
+ //throw new ServletException(e);
+ return (mapping.findForward(LEARNING_STARTER));
+ }
+
+ logger.debug("success getting nextUrl: "+ nextUrl);
+ voteLearningForm.resetCommands();
+
+ /* pay attention here*/
+ logger.debug("redirecting to the nextUrl: "+ nextUrl);
+ response.sendRedirect(nextUrl);
+
+ return null;
+
+ }
+
public ActionForward continueOptionsCombined(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
@@ -150,6 +247,7 @@
VoteLearningForm voteLearningForm = (VoteLearningForm) form;
IVoteService voteService =VoteUtils.getToolService(request);
+
/* process the answers */
Map mapGeneralCheckedOptionsContent=(Map) request.getSession().getAttribute(MAP_GENERAL_CHECKED_OPTIONS_CONTENT);
logger.debug("final mapGeneralCheckedOptionsContent: " + mapGeneralCheckedOptionsContent);
@@ -179,15 +277,98 @@
VoteQueUsr voteQueUsr=LearningUtil.getUser(request);
logger.debug("voteQueUsr: " + voteQueUsr);
+ String maxNominationCount=voteLearningForm.getMaxNominationCount();
+ logger.debug("current maxNominationCount: " + maxNominationCount);
+
+ int intMaxNominationCount=0;
+ if (maxNominationCount != null)
+ intMaxNominationCount=new Integer(maxNominationCount).intValue();
+
+ logger.debug("intMaxNominationCount: " + intMaxNominationCount);
+
+
+ int nominationCount=voteService.getLastNominationCount(voteQueUsr.getQueUsrId());
+ logger.debug("current nominationCount: " + nominationCount);
+
- LearningUtil.createAttempt(request, voteQueUsr, mapGeneralCheckedOptionsContent, userEntry);
- logger.debug("created user attempt in the db");
+ if (intMaxNominationCount != 0)
+ {
+ if (nominationCount >= intMaxNominationCount)
+ {
+ logger.debug("max nom count reached...");
+ logger.debug("fwd'ing to: " + EXIT_PAGE);
+ return (mapping.findForward(EXIT_PAGE));
+ }
+ }
+ logger.debug("new nominationCount: " + nominationCount+1);
+
+ logger.debug("creating attemps with mapGeneralCheckedOptionsContent " + mapGeneralCheckedOptionsContent);
+ voteService.removeAttemptsForUser(voteQueUsr.getUid());
+ logger.debug("nominations deleted for user: " + voteQueUsr.getUid());
+ LearningUtil.createAttempt(request, voteQueUsr, mapGeneralCheckedOptionsContent, userEntry, nominationCount++, false);
+
+ if (mapGeneralCheckedOptionsContent.size() == 0)
+ {
+ logger.debug("mapGeneralCheckedOptionsContent size is 0");
+ Map mapLeanerCheckedOptionsContent= new TreeMap(new VoteComparator());
+ mapLeanerCheckedOptionsContent.put("101", userEntry);
+ //request.getSession().setAttribute(MAP_GENERAL_CHECKED_OPTIONS_CONTENT, mapLeanerCheckedOptionsContent);
+ logger.debug("after mapsize check mapLeanerCheckedOptionsContent " + mapLeanerCheckedOptionsContent);
+ logger.debug("using nominationCount: " + nominationCount);
+ if (userEntry.length() > 0)
+ {
+ logger.debug("creating entry for: " + userEntry);
+ LearningUtil.createAttempt(request, voteQueUsr, mapLeanerCheckedOptionsContent, userEntry, nominationCount, true);
+ }
+
+
+
+ }
+
+ logger.debug("created user attempt in the db");
voteLearningForm.resetCommands();
+
+ mapGeneralCheckedOptionsContent=(Map) request.getSession().getAttribute(MAP_GENERAL_CHECKED_OPTIONS_CONTENT);
+ logger.debug("final mapGeneralCheckedOptionsContent: " + mapGeneralCheckedOptionsContent);
+
return (mapping.findForward(INDIVIDUAL_REPORT));
}
+ public ActionForward redoQuestions(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ logger.debug("dispatching redoQuestions...");
+ VoteUtils.cleanUpUserExceptions(request);
+ VoteLearningForm voteLearningForm = (VoteLearningForm) form;
+ IVoteService voteService =VoteUtils.getToolService(request);
+
+ Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID);
+ logger.debug("toolContentId:" + toolContentId);
+
+ VoteContent voteContent=voteService.retrieveVote(toolContentId);
+ logger.debug("voteContent:" + voteContent);
+
+ Map mapQuestionsContent= new TreeMap(new VoteComparator());
+ mapQuestionsContent=LearningUtil.buildQuestionContentMap(request,voteContent);
+ logger.debug("mapQuestionsContent: " + mapQuestionsContent);
+
+ request.getSession().setAttribute(MAP_QUESTION_CONTENT_LEARNER, mapQuestionsContent);
+ logger.debug("MAP_QUESTION_CONTENT_LEARNER: " + request.getSession().getAttribute(MAP_QUESTION_CONTENT_LEARNER));
+ logger.debug("voteContent has : " + mapQuestionsContent.size() + " entries.");
+
+ Map mapGeneralCheckedOptionsContent= new TreeMap(new VoteComparator());
+ request.getSession().setAttribute(MAP_GENERAL_CHECKED_OPTIONS_CONTENT, mapGeneralCheckedOptionsContent);
+
+ voteLearningForm.setUserEntry("");
+ return (mapping.findForward(LOAD_LEARNER));
+ }
+
+
public ActionForward selectOption(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningForm.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/Attic/VoteLearningForm.java,v
diff -u -r1.6 -r1.7
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningForm.java 22 Apr 2006 14:01:19 -0000 1.6
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningForm.java 23 Apr 2006 20:10:45 -0000 1.7
@@ -41,6 +41,15 @@
protected String dispatch;
protected String toolContentID;
+ protected String maxNominationCount;
+ protected String allowTextEntry;;
+ protected String lockOnFinish;
+ protected String voteChangable;
+ protected String activityRunOffline;
+ protected String activityRetries;
+ protected String activityTitle;
+ protected String activityInstructions;
+
protected String continueOptions;
protected String nextOptions;
protected String continueOptionsCombined;
@@ -431,4 +440,102 @@
public void setViewAllResults(String viewAllResults) {
this.viewAllResults = viewAllResults;
}
+
+ /**
+ * @return Returns the activityInstructions.
+ */
+ public String getActivityInstructions() {
+ return activityInstructions;
+ }
+ /**
+ * @param activityInstructions The activityInstructions to set.
+ */
+ public void setActivityInstructions(String activityInstructions) {
+ this.activityInstructions = activityInstructions;
+ }
+ /**
+ * @return Returns the activityTitle.
+ */
+ public String getActivityTitle() {
+ return activityTitle;
+ }
+ /**
+ * @param activityTitle The activityTitle to set.
+ */
+ public void setActivityTitle(String activityTitle) {
+ this.activityTitle = activityTitle;
+ }
+
+ /**
+ * @return Returns the activityRetries.
+ */
+ public String getActivityRetries() {
+ return activityRetries;
+ }
+ /**
+ * @param activityRetries The activityRetries to set.
+ */
+ public void setActivityRetries(String activityRetries) {
+ this.activityRetries = activityRetries;
+ }
+ /**
+ * @return Returns the activityRunOffline.
+ */
+ public String getActivityRunOffline() {
+ return activityRunOffline;
+ }
+ /**
+ * @param activityRunOffline The activityRunOffline to set.
+ */
+ public void setActivityRunOffline(String activityRunOffline) {
+ this.activityRunOffline = activityRunOffline;
+ }
+ /**
+ * @return Returns the voteChangable.
+ */
+ public String getVoteChangable() {
+ return voteChangable;
+ }
+ /**
+ * @param voteChangable The voteChangable to set.
+ */
+ public void setVoteChangable(String voteChangable) {
+ this.voteChangable = voteChangable;
+ }
+ /**
+ * @return Returns the lockOnFinish.
+ */
+ public String getLockOnFinish() {
+ return lockOnFinish;
+ }
+ /**
+ * @param lockOnFinish The lockOnFinish to set.
+ */
+ public void setLockOnFinish(String lockOnFinish) {
+ this.lockOnFinish = lockOnFinish;
+ }
+ /**
+ * @return Returns the allowTextEntry.
+ */
+ public String getAllowTextEntry() {
+ return allowTextEntry;
+ }
+ /**
+ * @param allowTextEntry The allowTextEntry to set.
+ */
+ public void setAllowTextEntry(String allowTextEntry) {
+ this.allowTextEntry = allowTextEntry;
+ }
+ /**
+ * @return Returns the maxNominationCount.
+ */
+ public String getMaxNominationCount() {
+ return maxNominationCount;
+ }
+ /**
+ * @param maxNominationCount The maxNominationCount to set.
+ */
+ public void setMaxNominationCount(String maxNominationCount) {
+ this.maxNominationCount = maxNominationCount;
+ }
}
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningStarterAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningStarterAction.java,v
diff -u -r1.3 -r1.4
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningStarterAction.java 21 Apr 2006 14:50:28 -0000 1.3
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningStarterAction.java 23 Apr 2006 20:10:45 -0000 1.4
@@ -116,16 +116,16 @@
Map mapQuestionsContent= new TreeMap(new VoteComparator());
Map mapAnswers= new TreeMap(new VoteComparator());
- IVoteService mcService = VoteUtils.getToolService(request);
- logger.debug("retrieving mcService from session: " + mcService);
- if (mcService == null)
+ IVoteService voteService = VoteUtils.getToolService(request);
+ logger.debug("retrieving voteService from session: " + voteService);
+ if (voteService == null)
{
- mcService = VoteServiceProxy.getVoteService(getServlet().getServletContext());
- logger.debug("retrieving mcService from proxy: " + mcService);
- request.getSession().setAttribute(TOOL_SERVICE, mcService);
+ voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext());
+ logger.debug("retrieving voteService from proxy: " + voteService);
+ request.getSession().setAttribute(TOOL_SERVICE, voteService);
}
- VoteLearningForm mcLearningForm = (VoteLearningForm) form;
+ VoteLearningForm voteLearningForm = (VoteLearningForm) form;
/*
* persist time zone information to session scope.
@@ -147,7 +147,7 @@
if ((createToolSession != null) && createToolSession.equals("1"))
{ try
{
- mcService.createToolSession(toolSessionID, "toolSessionName", new Long(9876));
+ voteService.createToolSession(toolSessionID, "toolSessionName", new Long(9876));
return (mapping.findForward(LEARNING_STARTER));
}
catch(ToolException e)
@@ -162,7 +162,7 @@
if ((removeToolSession != null) && removeToolSession.equals("1"))
{ try
{
- mcService.removeToolSession(toolSessionID);
+ voteService.removeToolSession(toolSessionID);
return (mapping.findForward(LEARNING_STARTER));
}
catch(ToolException e)
@@ -177,7 +177,7 @@
if (learnerId != null)
{ try
{
- String nextUrl=mcService.leaveToolSession(toolSessionID, new Long(learnerId));
+ String nextUrl=voteService.leaveToolSession(toolSessionID, new Long(learnerId));
logger.debug("nextUrl: "+ nextUrl);
return (mapping.findForward(LEARNING_STARTER));
}
@@ -195,13 +195,13 @@
* Make sure we can retrieve it and the relavent content
*/
- VoteSession mcSession=mcService.retrieveVoteSession(toolSessionID);
- logger.debug("retrieving mcSession: " + mcSession);
+ VoteSession voteSession=voteService.retrieveVoteSession(toolSessionID);
+ logger.debug("retrieving voteSession: " + voteSession);
- if (mcSession == null)
+ if (voteSession == null)
{
VoteUtils.cleanUpSessionAbsolute(request);
- logger.debug("error: The tool expects mcSession.");
+ logger.debug("error: The tool expects voteSession.");
request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
persistError(request,"error.toolSession.notAvailable");
return (mapping.findForward(ERROR_LIST));
@@ -212,13 +212,13 @@
* get the content for this tool session
* Each passed tool session id points to a particular content. Many to one mapping.
*/
- VoteContent mcContent=mcSession.getVoteContent();
- logger.debug("using mcContent: " + mcContent);
+ VoteContent voteContent=voteSession.getVoteContent();
+ logger.debug("using voteContent: " + voteContent);
- if (mcContent == null)
+ if (voteContent == null)
{
VoteUtils.cleanUpSessionAbsolute(request);
- logger.debug("error: The tool expects mcContent.");
+ logger.debug("error: The tool expects voteContent.");
persistError(request,"error.content.doesNotExist");
request.getSession().setAttribute(USER_EXCEPTION_CONTENT_DOESNOTEXIST, new Boolean(true).toString());
return (mapping.findForward(ERROR_LIST));
@@ -229,13 +229,13 @@
* The content we retrieved above must have been created before in Authoring time.
* And the passed tool session id already refers to it.
*/
- setupAttributes(request, mcContent);
+ setupAttributes(request, voteContent, voteLearningForm);
- request.getSession().setAttribute(TOOL_CONTENT_ID, mcContent.getVoteContentId());
- logger.debug("using TOOL_CONTENT_ID: " + mcContent.getVoteContentId());
+ request.getSession().setAttribute(TOOL_CONTENT_ID, voteContent.getVoteContentId());
+ logger.debug("using TOOL_CONTENT_ID: " + voteContent.getVoteContentId());
- request.getSession().setAttribute(TOOL_CONTENT_UID, mcContent.getUid());
- logger.debug("using TOOL_CONTENT_UID: " + mcContent.getUid());
+ request.getSession().setAttribute(TOOL_CONTENT_UID, voteContent.getUid());
+ logger.debug("using TOOL_CONTENT_UID: " + voteContent.getUid());
/* Is the request for a preview by the author?
Preview The tool must be able to show the specified content as if it was running in a lesson.
@@ -253,18 +253,16 @@
if ((mode != null) && (mode.equals("author")))
{
logger.debug("Author requests for a preview of the content.");
- logger.debug("existing mcContent:" + mcContent);
+ logger.debug("existing voteContent:" + voteContent);
- commonContentSetup(request, mcContent);
+ commonContentSetup(request, voteContent);
- /*only allowing combined view in the preview mode. Might be improved to support sequential view as well. */
- request.getSession().setAttribute(QUESTION_LISTING_MODE, QUESTION_LISTING_MODE_COMBINED);
- /* PREVIEW_ONLY for jsp*/
+ /* PREVIEW_ONLY for jsp*/
request.getSession().setAttribute(PREVIEW_ONLY, new Boolean(true).toString());
request.getSession().setAttribute(CURRENT_QUESTION_INDEX, "1");
- VoteLearningAction mcLearningAction= new VoteLearningAction();
- //return mcLearningAction.redoQuestions(request, mcLearningForm, mapping);
+ VoteLearningAction voteLearningAction= new VoteLearningAction();
+ //return voteLearningAction.redoQuestions(request, voteLearningForm, mapping);
return null;
}
@@ -276,17 +274,17 @@
if ((userId != null) && (mode.equals("teacher")))
{
logger.debug("request is for learner progress");
- commonContentSetup(request, mcContent);
+ commonContentSetup(request, voteContent);
/* LEARNER_PROGRESS for jsp*/
request.getSession().setAttribute(LEARNER_PROGRESS_USERID, userId);
request.getSession().setAttribute(LEARNER_PROGRESS, new Boolean(true).toString());
- VoteLearningAction mcLearningAction= new VoteLearningAction();
+ VoteLearningAction voteLearningAction= new VoteLearningAction();
/* pay attention that this userId is the learner's userId passed by the request parameter.
* It is differerent than USER_ID kept in the session of the current system user*/
- VoteQueUsr mcQueUsr=mcService.retrieveVoteQueUsr(new Long(userId));
- logger.debug("mcQueUsr:" + mcQueUsr);
- if (mcQueUsr == null)
+ VoteQueUsr voteQueUsr=voteService.retrieveVoteQueUsr(new Long(userId));
+ logger.debug("voteQueUsr:" + voteQueUsr);
+ if (voteQueUsr == null)
{
VoteUtils.cleanUpSessionAbsolute(request);
persistError(request, "error.learner.required");
@@ -295,28 +293,28 @@
}
/* check whether the user's session really referrs to the session id passed to the url*/
- Long sessionUid=mcQueUsr.getVoteSessionId();
+ Long sessionUid=voteQueUsr.getVoteSessionId();
logger.debug("sessionUid" + sessionUid);
- VoteSession mcSessionLocal=mcService.getVoteSessionByUID(sessionUid);
- logger.debug("checking mcSessionLocal" + mcSessionLocal);
+ VoteSession voteSessionLocal=voteService.getVoteSessionByUID(sessionUid);
+ logger.debug("checking voteSessionLocal" + voteSessionLocal);
Long toolSessionId=(Long)request.getSession().getAttribute(TOOL_SESSION_ID);
- logger.debug("toolSessionId: " + toolSessionId + " versus" + mcSessionLocal);
- if ((mcSessionLocal == null) ||
- (mcSessionLocal.getVoteSessionId().longValue() != toolSessionId.longValue()))
+ logger.debug("toolSessionId: " + toolSessionId + " versus" + voteSessionLocal);
+ if ((voteSessionLocal == null) ||
+ (voteSessionLocal.getVoteSessionId().longValue() != toolSessionId.longValue()))
{
VoteUtils.cleanUpSessionAbsolute(request);
request.getSession().setAttribute(USER_EXCEPTION_TOOLSESSIONID_INCONSISTENT, new Boolean(true).toString());
persistError(request, "error.learner.sessionId.inconsistent");
return (mapping.findForward(ERROR_LIST));
}
- //return mcLearningAction.viewAnswers(mapping, form, request, response);
+ //return voteLearningAction.viewAnswers(mapping, form, request, response);
return null;
}
/* by now, we know that the mode is learner*/
/* find out if the content is set to run offline or online. If it is set to run offline , the learners are informed about that. */
- boolean isRunOffline=VoteUtils.isRunOffline(mcContent);
+ boolean isRunOffline=VoteUtils.isRunOffline(voteContent);
logger.debug("isRunOffline: " + isRunOffline);
if (isRunOffline == true)
{
@@ -328,7 +326,7 @@
}
/* find out if the content is being modified at the moment. */
- boolean isDefineLater=VoteUtils.isDefineLater(mcContent);
+ boolean isDefineLater=VoteUtils.isDefineLater(voteContent);
logger.debug("isDefineLater: " + isDefineLater);
if (isDefineLater == true)
{
@@ -342,13 +340,12 @@
/*
* fetch question content from content
*/
- mapQuestionsContent=LearningUtil.buildQuestionContentMap(request,mcContent);
+ mapQuestionsContent=LearningUtil.buildQuestionContentMap(request,voteContent);
logger.debug("mapQuestionsContent: " + mapQuestionsContent);
request.getSession().setAttribute(MAP_QUESTION_CONTENT_LEARNER, mapQuestionsContent);
logger.debug("MAP_QUESTION_CONTENT_LEARNER: " + request.getSession().getAttribute(MAP_QUESTION_CONTENT_LEARNER));
- logger.debug("mcContent has : " + mapQuestionsContent.size() + " entries.");
- request.getSession().setAttribute(TOTAL_QUESTION_COUNT, new Long(mapQuestionsContent.size()).toString());
+ logger.debug("voteContent has : " + mapQuestionsContent.size() + " entries.");
request.getSession().setAttribute(CURRENT_QUESTION_INDEX, "1");
logger.debug("CURRENT_QUESTION_INDEX: " + request.getSession().getAttribute(CURRENT_QUESTION_INDEX));
@@ -362,46 +359,46 @@
String userID=(String) request.getSession().getAttribute(USER_ID);
logger.debug("userID:" + userID);
- VoteQueUsr mcQueUsr=mcService.retrieveVoteQueUsr(new Long(userID));
- logger.debug("mcQueUsr:" + mcQueUsr);
+ VoteQueUsr voteQueUsr=voteService.retrieveVoteQueUsr(new Long(userID));
+ logger.debug("voteQueUsr:" + voteQueUsr);
- if (mcQueUsr != null)
+ if (voteQueUsr != null)
{
- logger.debug("mcQueUsr is available in the db:" + mcQueUsr);
- Long queUsrId=mcQueUsr.getUid();
+ logger.debug("voteQueUsr is available in the db:" + voteQueUsr);
+ Long queUsrId=voteQueUsr.getUid();
logger.debug("queUsrId: " + queUsrId);
}
else
{
- logger.debug("mcQueUsr is not available in the db:" + mcQueUsr);
+ logger.debug("voteQueUsr is not available in the db:" + voteQueUsr);
}
String learningMode=(String) request.getSession().getAttribute(LEARNING_MODE);
logger.debug("users learning mode is: " + learningMode);
/*if the user's session id AND user id exists in the tool tables go to redo questions.*/
- if ((mcQueUsr != null) && learningMode.equals("learner"))
+ if ((voteQueUsr != null) && learningMode.equals("learner"))
{
- Long sessionUid=mcQueUsr.getVoteSessionId();
+ Long sessionUid=voteQueUsr.getVoteSessionId();
logger.debug("users sessionUid: " + sessionUid);
- VoteSession mcUserSession= mcService.getVoteSessionByUID(sessionUid);
- logger.debug("mcUserSession: " + mcUserSession);
- String userSessionId=mcUserSession.getVoteSessionId().toString();
+ VoteSession voteUserSession= voteService.getVoteSessionByUID(sessionUid);
+ logger.debug("voteUserSession: " + voteUserSession);
+ String userSessionId=voteUserSession.getVoteSessionId().toString();
logger.debug("userSessionId: " + userSessionId);
Long toolSessionId=(Long)request.getSession().getAttribute(TOOL_SESSION_ID);
logger.debug("current toolSessionId: " + toolSessionId);
if (toolSessionId.toString().equals(userSessionId))
{
- logger.debug("the user's session id AND user id exists in the tool tables go to redo questions. " + toolSessionId + " mcQueUsr: " +
- mcQueUsr + " user id: " + mcQueUsr.getQueUsrId());
+ logger.debug("the user's session id AND user id exists in the tool tables go to redo questions. " + toolSessionId + " voteQueUsr: " +
+ voteQueUsr + " user id: " + voteQueUsr.getQueUsrId());
logger.debug("the learner has already responsed to this content, just generate a read-only report. Use redo questions for this.");
return (mapping.findForward(REDO_QUESTIONS));
}
}
else if (learningMode.equals("teacher"))
{
- VoteLearningAction mcLearningAction= new VoteLearningAction();
+ VoteLearningAction voteLearningAction= new VoteLearningAction();
logger.debug("present to teacher learners progress...");
- //return mcLearningAction.viewAnswers(mapping, form, request, response);
+ //return voteLearningAction.viewAnswers(mapping, form, request, response);
return null;
}
return (mapping.findForward(LOAD_LEARNER));
@@ -410,20 +407,20 @@
/**
* sets up question and candidate answers maps
- * commonContentSetup(HttpServletRequest request, VoteContent mcContent)
+ * commonContentSetup(HttpServletRequest request, VoteContent voteContent)
*
* @param request
- * @param mcContent
+ * @param voteContent
*/
-protected void commonContentSetup(HttpServletRequest request, VoteContent mcContent)
+protected void commonContentSetup(HttpServletRequest request, VoteContent voteContent)
{
Map mapQuestionsContent= new TreeMap(new VoteComparator());
- mapQuestionsContent=LearningUtil.buildQuestionContentMap(request,mcContent);
+ mapQuestionsContent=LearningUtil.buildQuestionContentMap(request,voteContent);
logger.debug("mapQuestionsContent: " + mapQuestionsContent);
request.getSession().setAttribute(MAP_QUESTION_CONTENT_LEARNER, mapQuestionsContent);
logger.debug("MAP_QUESTION_CONTENT_LEARNER: " + request.getSession().getAttribute(MAP_QUESTION_CONTENT_LEARNER));
- logger.debug("mcContent has : " + mapQuestionsContent.size() + " entries.");
+ logger.debug("voteContent has : " + mapQuestionsContent.size() + " entries.");
request.getSession().setAttribute(TOTAL_QUESTION_COUNT, new Long(mapQuestionsContent.size()).toString());
request.getSession().setAttribute(CURRENT_QUESTION_INDEX, "1");
@@ -434,32 +431,50 @@
/**
* sets up session scope attributes based on content linked to the passed tool session id
- * setupAttributes(HttpServletRequest request, VoteContent mcContent)
+ * setupAttributes(HttpServletRequest request, VoteContent voteContent)
*
* @param request
- * @param mcContent
+ * @param voteContent
*/
- protected void setupAttributes(HttpServletRequest request, VoteContent mcContent)
+ protected void setupAttributes(HttpServletRequest request, VoteContent voteContent, VoteLearningForm voteLearningForm)
{
- logger.debug("IS_RETRIES: " + new Boolean(mcContent.isRetries()).toString());
- request.getSession().setAttribute(IS_RETRIES, new Boolean(mcContent.isRetries()).toString());
+ logger.debug("IS_RETRIES: " + new Boolean(voteContent.isRetries()).toString());
+ //request.getSession().setAttribute(IS_RETRIES, new Boolean(voteContent.isRetries()).toString());
- logger.debug("IS_CONTENT_IN_USE: " + mcContent.isContentInUse());
- request.getSession().setAttribute(IS_CONTENT_IN_USE, new Boolean(mcContent.isContentInUse()).toString());
+ logger.debug("IS_CONTENT_IN_USE: " + voteContent.isContentInUse());
- request.getSession().setAttribute(ACTIVITY_TITLE, mcContent.getTitle());
- request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, mcContent.getInstructions());
+ //request.getSession().setAttribute(ACTIVITY_TITLE, voteContent.getTitle());
+ //request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, voteContent.getInstructions());
Map mapGeneralCheckedOptionsContent= new TreeMap(new VoteComparator());
request.getSession().setAttribute(MAP_GENERAL_CHECKED_OPTIONS_CONTENT, mapGeneralCheckedOptionsContent);
-
-
/*
* Is the tool activity been checked as Run Offline in the property inspector?
*/
- logger.debug("IS_TOOL_ACTIVITY_OFFLINE: " + mcContent.isRunOffline());
- request.getSession().setAttribute(IS_TOOL_ACTIVITY_OFFLINE, new Boolean(mcContent.isRunOffline()).toString());
+ logger.debug("IS_TOOL_ACTIVITY_OFFLINE: " + voteContent.isRunOffline());
+ //request.getSession().setAttribute(IS_TOOL_ACTIVITY_OFFLINE, new Boolean(voteContent.isRunOffline()).toString());
+
+
+ logger.debug("advanced properties isRetries: " + new Boolean(voteContent.isRetries()).toString());
+ logger.debug("advanced properties maxNominationCount: " + voteContent.getMaxNominationCount());
+ logger.debug("advanced properties isAllowText(): " + new Boolean(voteContent.isAllowText()).toString());
+ logger.debug("advanced properties isVoteChangable(): " + new Boolean(voteContent.isVoteChangable()).toString());
+
+ logger.debug("advanced properties isRunOffline(): " + new Boolean(voteContent.isRunOffline()).toString());
+ logger.debug("advanced properties isRetries(): " + new Boolean(voteContent.isRetries()).toString());
+ logger.debug("advanced properties isLockOnFinish(): " + new Boolean(voteContent.isLockOnFinish()).toString());
+
+
+ voteLearningForm.setActivityTitle(voteContent.getTitle());
+ voteLearningForm.setActivityInstructions(voteContent.getInstructions());
+ voteLearningForm.setActivityRetries(new Boolean(voteContent.isRetries()).toString());
+ voteLearningForm.setActivityRunOffline(new Boolean(voteContent.isRunOffline()).toString());
+
+ voteLearningForm.setMaxNominationCount(voteContent.getMaxNominationCount());
+ voteLearningForm.setAllowTextEntry(new Boolean(voteContent.isAllowText()).toString());
+ voteLearningForm.setLockOnFinish(new Boolean(voteContent.isLockOnFinish()).toString());
+ voteLearningForm.setVoteChangable(new Boolean(voteContent.isVoteChangable()).toString());
}