Index: lams_tool_scratchie/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/conf/language/lams/ApplicationResources_en_AU.properties,v diff -u -r1.27 -r1.28 --- lams_tool_scratchie/conf/language/lams/ApplicationResources_en_AU.properties 17 Jul 2014 14:40:23 -0000 1.27 +++ lams_tool_scratchie/conf/language/lams/ApplicationResources_en_AU.properties 11 Feb 2015 23:00:52 -0000 1.28 @@ -189,5 +189,9 @@ error.entered.marks.not.comma.separates =Entered marks are not in a correct format of comma separated values. label.authoring.export.qti =Export IMS QTI +label.authoring.advanced.burning.questions =Option for burning questions +label.continue.burning.questions =Continue with burning questions +label.raise.burning.question =Raise burning question +label.burning.questions =Burning questions #======= End labels: Exported 182 labels for en AU ===== Index: lams_tool_scratchie/conf/xdoclet/struts-actions.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/conf/xdoclet/struts-actions.xml,v diff -u -r1.20 -r1.21 --- lams_tool_scratchie/conf/xdoclet/struts-actions.xml 13 Jun 2014 18:50:12 -0000 1.20 +++ lams_tool_scratchie/conf/xdoclet/struts-actions.xml 11 Feb 2015 23:00:52 -0000 1.21 @@ -195,6 +195,20 @@ + + + + + + + + + + - + - Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/ScratchieConstants.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/ScratchieConstants.java,v diff -u -r1.22 -r1.23 --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/ScratchieConstants.java 19 Sep 2014 13:37:41 -0000 1.22 +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/ScratchieConstants.java 11 Feb 2015 23:00:52 -0000 1.23 @@ -36,6 +36,8 @@ // for action forward name public static final String SUCCESS = "success"; + + public static final String NOTEBOOK = "notebook"; public static final String ERROR = "error"; @@ -67,6 +69,10 @@ public static final String ATTR_ITEM_LIST = "itemList"; + public static final String ATTR_BURNING_QUESTION_PREFIX = "burningQuestion"; + + public static final String ATTR_BURNING_QUESTIONS = "burningQuestions"; + public static final String ATTR_ITEM_ORDER_ID_PREFIX = "itemOrderId"; public static final String ATTR_ITEM_TITLE_PREFIX = "itemTitle"; @@ -130,9 +136,11 @@ public static final String ATTR_USER_FINISHED = "userFinished"; public static final String ATTR_IS_GROUPED_ACTIVITY = "isGroupedActivity"; - + public static final String ATTR_REFLECTION_ON = "reflectOn"; + public static final String ATTR_IS_BURNING_QUESTIONS_ENABLED = "isBurningQuestionsEnabled"; + public static final String ATTR_REFLECTION_INSTRUCTION = "reflectInstructions"; public static final String ATTR_REFLECTION_ENTRY = "reflectEntry"; Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/scratchieApplicationContext.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/scratchieApplicationContext.xml,v diff -u -r1.16 -r1.17 --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/scratchieApplicationContext.xml 13 Jun 2014 18:50:12 -0000 1.16 +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/scratchieApplicationContext.xml 11 Feb 2015 23:00:52 -0000 1.17 @@ -27,6 +27,11 @@ + + + + + @@ -65,6 +70,9 @@ + + + Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieBurningQuestionDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieBurningQuestionDAO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieBurningQuestionDAO.java 11 Feb 2015 23:00:52 -0000 1.1 @@ -0,0 +1,40 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id: ScratchieBurningQuestionDAO.java,v 1.1 2015/02/11 23:00:52 andreyb Exp $ */ +package org.lamsfoundation.lams.tool.scratchie.dao; + +import java.util.List; + +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieBurningQuestion; + +public interface ScratchieBurningQuestionDAO extends DAO { + + ScratchieBurningQuestion getBurningQuestion(Long answerUid, Long sessionId); + + int getBurningQuestionCountTotal(Long sessionId); + + ScratchieBurningQuestion getBurningQuestionBySessionAndItem(Long sessionId, Long itemUid); + + List getBurningQuestionsBySession(Long sessionId); + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieBurningQuestionDAOHibernate.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieBurningQuestionDAOHibernate.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieBurningQuestionDAOHibernate.java 11 Feb 2015 23:00:52 -0000 1.1 @@ -0,0 +1,74 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id: ScratchieBurningQuestionDAOHibernate.java,v 1.1 2015/02/11 23:00:52 andreyb Exp $ */ +package org.lamsfoundation.lams.tool.scratchie.dao.hibernate; + +import java.util.List; + +import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieBurningQuestionDAO; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieBurningQuestion; + +public class ScratchieBurningQuestionDAOHibernate extends BaseDAOHibernate implements ScratchieBurningQuestionDAO { + + private static final String FIND_BY_SESSION_AND_ANSWER = "from " + ScratchieBurningQuestion.class.getName() + + " as r where r.sessionId = ? and r.scratchieItem.uid=?"; + + private static final String FIND_BY_SESSION_AND_ITEM = "from " + ScratchieBurningQuestion.class.getName() + + " as r where r.sessionId=? and r.scratchieItem.uid = ?"; + + private static final String FIND_BY_SESSION = "from " + ScratchieBurningQuestion.class.getName() + + " as r where r.sessionId=? order by r.scratchieItem.orderId asc"; + + private static final String FIND_VIEW_COUNT_BY_SESSION = "select count(*) from " + + ScratchieBurningQuestion.class.getName() + " as r where r.sessionId=?"; + + @Override + public ScratchieBurningQuestion getBurningQuestion(Long answerUid, Long sessionId) { + List list = getHibernateTemplate().find(FIND_BY_SESSION_AND_ANSWER, new Object[] { sessionId, answerUid }); + if (list == null || list.size() == 0) + return null; + return (ScratchieBurningQuestion) list.get(0); + } + + @Override + public int getBurningQuestionCountTotal(Long sessionId) { + List list = getHibernateTemplate().find(FIND_VIEW_COUNT_BY_SESSION, new Object[] { sessionId}); + if (list == null || list.size() == 0) + return 0; + return ((Number) list.get(0)).intValue(); + } + + @Override + public ScratchieBurningQuestion getBurningQuestionBySessionAndItem(Long sessionId, Long itemUid) { + List list = getHibernateTemplate().find(FIND_BY_SESSION_AND_ITEM, new Object[] { sessionId, itemUid }); + if (list == null || list.size() == 0) + return null; + return (ScratchieBurningQuestion) list.get(0); + } + + @Override + public List getBurningQuestionsBySession(Long sessionId) { + return getHibernateTemplate().find(FIND_BY_SESSION, new Object[] { sessionId }); + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dbupdates/patch20150206.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dbupdates/patch20150206.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dbupdates/patch20150206.sql 11 Feb 2015 23:00:52 -0000 1.1 @@ -0,0 +1,26 @@ +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; +----------------------Put all sql statements below here------------------------- + +-- LDEV- +ALTER TABLE tl_lascrt11_scratchie ADD COLUMN burning_questions_enabled TINYINT DEFAULT 1; +CREATE TABLE tl_lascrt11_burning_question ( + uid bigint NOT NULL auto_increment, + access_date DATETIME, + scratchie_item_uid BIGINT, + session_id BIGINT, + question TEXT, + PRIMARY KEY (uid) +)ENGINE=InnoDB; +ALTER TABLE tl_lascrt11_burning_question ADD INDEX FK_NEW_610529188_693580A438BF8DF2 (scratchie_item_uid), ADD CONSTRAINT FK_NEW_610529188_693580A438BF8DF2 FOREIGN KEY (scratchie_item_uid) REFERENCES tl_lascrt11_scratchie_item (uid); +ALTER TABLE tl_lascrt11_burning_question ADD INDEX sessionIdIndex2 (session_id), ADD CONSTRAINT sessionIdIndex2 FOREIGN KEY (session_id) REFERENCES tl_lascrt11_session (session_id); + +UPDATE lams_tool SET tool_version='20150206' WHERE tool_signature='lascrt11'; + +----------------------Put all sql statements above here------------------------- + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; +SET FOREIGN_KEY_CHECKS=1; Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/Scratchie.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/Scratchie.java,v diff -u -r1.9 -r1.10 --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/Scratchie.java 6 May 2014 13:26:33 -0000 1.9 +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/Scratchie.java 11 Feb 2015 23:00:52 -0000 1.10 @@ -69,6 +69,8 @@ private Set scratchieItems; private boolean extraPoint; + + private boolean burningQuestionsEnabled; private boolean reflectOnActivity; @@ -329,4 +331,16 @@ public void setExtraPoint(boolean extraPoint) { this.extraPoint = extraPoint; } + + /** + * @hibernate.property column="burning_questions_enabled" + * @return + */ + public boolean isBurningQuestionsEnabled() { + return burningQuestionsEnabled; + } + + public void setBurningQuestionsEnabled(boolean burningQuestionsEnabled) { + this.burningQuestionsEnabled = burningQuestionsEnabled; + } } Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieBurningQuestion.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieBurningQuestion.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieBurningQuestion.java 11 Feb 2015 23:00:52 -0000 1.1 @@ -0,0 +1,104 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id: ScratchieBurningQuestion.java,v 1.1 2015/02/11 23:00:52 andreyb Exp $ */ +package org.lamsfoundation.lams.tool.scratchie.model; + +import java.util.Date; + +/** + * ScratchieBurningQuestion + * + * @author Andrey Balan + * + * @hibernate.class table="tl_lascrt11_burning_question" + * + */ +public class ScratchieBurningQuestion { + + private Long uid; + private ScratchieItem scratchieItem; + private Date accessDate; + private Long sessionId; + private String question; + + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" + * @return Returns the log Uid. + */ + public Long getUid() { + return uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + /** + * @hibernate.property column="access_date" + * @return + */ + public Date getAccessDate() { + return accessDate; + } + + public void setAccessDate(Date accessDate) { + this.accessDate = accessDate; + } + + /** + * @hibernate.many-to-one column="scratchie_item_uid" cascade="none" + * @return + */ + public ScratchieItem getScratchieItem() { + return scratchieItem; + } + + public void setScratchieItem(ScratchieItem scratchieItem) { + this.scratchieItem = scratchieItem; + } + + /** + * @hibernate.property column="session_id" + * @return + */ + public Long getSessionId() { + return sessionId; + } + + public void setSessionId(Long sessionId) { + this.sessionId = sessionId; + } + + /** + * @hibernate.property column="question" type="text" + * @return + */ + public String getQuestion() { + return question; + } + + public void setQuestion(String question) { + this.question = question; + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieItem.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieItem.java,v diff -u -r1.6 -r1.7 --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieItem.java 9 Oct 2013 16:11:44 -0000 1.6 +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieItem.java 11 Feb 2015 23:00:52 -0000 1.7 @@ -64,6 +64,7 @@ private int userMark; private int userAttempts; private String firstChoiceAnswerLetter; + private String burningQuestion; /** * Default contruction method. @@ -232,4 +233,12 @@ public void setFirstChoiceAnswerLetter(String firstChoiceAnswerLetter) { this.firstChoiceAnswerLetter = firstChoiceAnswerLetter; } + + public String getBurningQuestion() { + return burningQuestion; + } + + public void setBurningQuestion(String burningQuestion) { + this.burningQuestion = burningQuestion; + } } Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/IScratchieService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/IScratchieService.java,v diff -u -r1.29 -r1.30 --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/IScratchieService.java 13 Jun 2014 18:50:12 -0000 1.29 +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/IScratchieService.java 11 Feb 2015 23:00:52 -0000 1.30 @@ -34,6 +34,7 @@ import org.lamsfoundation.lams.tool.scratchie.dto.ReflectDTO; import org.lamsfoundation.lams.tool.scratchie.model.Scratchie; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieAnswer; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieBurningQuestion; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieConfigItem; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieSession; @@ -63,6 +64,17 @@ */ ScratchieUser checkLeaderSelectToolForSessionLeader(ScratchieUser user, Long toolSessionId); + List getBurningQuestionsBySession(Long sessionId); + + /** + * Save or update burningQuestion into database. + * + * @param sessionId + * @param itemUid + * @param question + */ + void saveBurningQuestion(Long sessionId, Long itemUid, String question); + ScratchieAnswer getScratchieAnswerByUid (Long answerUid); /** Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieImportContentVersionFilter.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieImportContentVersionFilter.java,v diff -u -r1.3 -r1.4 --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieImportContentVersionFilter.java 6 May 2014 13:26:33 -0000 1.3 +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieImportContentVersionFilter.java 11 Feb 2015 23:00:52 -0000 1.4 @@ -67,4 +67,11 @@ public void up20140102To20140505() { this.removeField(Scratchie.class, "contentInUse"); } + + /** + * Import 20140613 version content to 20150206 version tool server. + */ + public void up20140613To20150206() { + this.addField(Scratchie.class, "burningQuestionsEnabled", new Integer(1)); + } } Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java,v diff -u -r1.52 -r1.53 --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java 22 Sep 2014 20:53:44 -0000 1.52 +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java 11 Feb 2015 23:00:52 -0000 1.53 @@ -64,6 +64,7 @@ import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.scratchie.ScratchieConstants; import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieAnswerVisitDAO; +import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieBurningQuestionDAO; import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieConfigItemDAO; import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieDAO; import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieItemDAO; @@ -74,6 +75,7 @@ import org.lamsfoundation.lams.tool.scratchie.model.Scratchie; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieAnswer; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieAnswerVisitLog; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieBurningQuestion; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieConfigItem; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieSession; @@ -108,6 +110,8 @@ private ScratchieAnswerVisitDAO scratchieAnswerVisitDao; + private ScratchieBurningQuestionDAO scratchieBurningQuestionDao; + private ScratchieConfigItemDAO scratchieConfigItemDao; // tool service @@ -416,7 +420,30 @@ } } + + @Override + public List getBurningQuestionsBySession(Long sessionId) { + return scratchieBurningQuestionDao.getBurningQuestionsBySession(sessionId); + } + + @Override + public void saveBurningQuestion(Long sessionId, Long itemUid, String question) { + + ScratchieBurningQuestion burningQuestion = scratchieBurningQuestionDao.getBurningQuestionBySessionAndItem(sessionId, itemUid); + + if (burningQuestion == null) { + burningQuestion = new ScratchieBurningQuestion(); + ScratchieItem item = scratchieItemDao.getByUid(itemUid); + burningQuestion.setScratchieItem(item); + burningQuestion.setSessionId(sessionId); + burningQuestion.setAccessDate(new Date()); + } + scratchieBurningQuestionDao.saveObject(burningQuestion); + } + + + @Override public ScratchieAnswer getScratchieAnswerByUid(Long answerUid) { ScratchieAnswer res = (ScratchieAnswer) userManagementService.findById(ScratchieAnswer.class, answerUid); @@ -1492,6 +1519,10 @@ this.scratchieAnswerVisitDao = scratchieItemVisitDao; } + public void setScratchieBurningQuestionDao(ScratchieBurningQuestionDAO scratchieBurningQuestionDao) { + this.scratchieBurningQuestionDao = scratchieBurningQuestionDao; + } + public void setScratchieConfigItemDao(ScratchieConfigItemDAO scratchieConfigItemDao) { this.scratchieConfigItemDao = scratchieConfigItemDao; } Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningAction.java,v diff -u -r1.45 -r1.46 --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningAction.java 19 Sep 2014 13:37:41 -0000 1.45 +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningAction.java 11 Feb 2015 23:00:52 -0000 1.46 @@ -41,6 +41,7 @@ import javax.servlet.http.HttpSession; import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.NumberUtils; import org.apache.log4j.Logger; import org.apache.struts.action.Action; @@ -59,6 +60,7 @@ import org.lamsfoundation.lams.tool.scratchie.dto.ReflectDTO; import org.lamsfoundation.lams.tool.scratchie.model.Scratchie; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieAnswer; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieBurningQuestion; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieSession; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieUser; @@ -107,6 +109,12 @@ if (param.equals("finish")) { return finish(mapping, form, request, response); } + if (param.equals("showBurningQuestions")) { + return showBurningQuestions(mapping, form, request, response); + } + if (param.equals("saveBurningQuestions")) { + return saveBurningQuestions(mapping, form, request, response); + } if (param.equals("showResults")) { return showResults(mapping, form, request, response); } @@ -202,6 +210,7 @@ sessionMap.put(ScratchieConstants.ATTR_USER_FINISHED, isUserFinished); sessionMap.put(AttributeNames.PARAM_TOOL_SESSION_ID, toolSessionId); sessionMap.put(AttributeNames.ATTR_MODE, mode); + sessionMap.put(ScratchieConstants.ATTR_IS_BURNING_QUESTIONS_ENABLED, scratchie.isBurningQuestionsEnabled()); // reflection information sessionMap.put(ScratchieConstants.ATTR_REFLECTION_ON, isReflectOnActivity); sessionMap.put(ScratchieConstants.ATTR_REFLECTION_INSTRUCTION, scratchie.getReflectInstructions()); @@ -252,6 +261,25 @@ LearningAction.service.getScratchesOrder(items, toolSessionId); } + // populate items with the existing burning questions for displaying purposes + if (scratchie.isBurningQuestionsEnabled()) { + + List burningQuestions = LearningAction.service + .getBurningQuestionsBySession(toolSessionId); + for (ScratchieItem item : items) { + + // find corresponding burningQuestion + String question = ""; + for (ScratchieBurningQuestion burningQuestion : burningQuestions) { + if (burningQuestion.getScratchieItem().getUid().equals(item.getUid())) { + question = burningQuestion.getQuestion(); + break; + } + } + item.setBurningQuestion(question); + } + } + // calculate max score int maxScore = items.size() * 4; if (scratchie.isExtraPoint()) { @@ -436,6 +464,7 @@ sessionMapID); request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMapID); boolean isReflectOnActivity = (Boolean) sessionMap.get(ScratchieConstants.ATTR_REFLECTION_ON); + boolean isBurningQuestionsEnabled = (Boolean) sessionMap.get(ScratchieConstants.ATTR_IS_BURNING_QUESTIONS_ENABLED); final Long toolSessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); ScratchieSession toolSession = LearningAction.service.getScratchieSessionBySessionId(toolSessionId); @@ -457,8 +486,13 @@ int maxScore = (Integer) sessionMap.get(ScratchieConstants.ATTR_MAX_SCORE); double percentage = (maxScore == 0) ? 0 : ((score * 100) / maxScore); request.setAttribute(ScratchieConstants.ATTR_SCORE, (int) percentage); + + // show burning questions page if it's enabled + if (isBurningQuestionsEnabled) { + + } - // Create reflectList if reflection is enabled. + // display other groups' notebooks if (isReflectOnActivity) { List reflections = LearningAction.service.getReflectionList(toolSession.getScratchie() .getContentId()); @@ -521,8 +555,108 @@ } return mapping.findForward(ScratchieConstants.SUCCESS); } + + /** + * Displays burning questions page. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws ScratchieApplicationException + */ + private ActionForward showBurningQuestions(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws ScratchieApplicationException { + initializeScratchieService(); + String sessionMapID = WebUtil.readStrParam(request, ScratchieConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMapID); + final Long toolSessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); + Long userUid = (Long) sessionMap.get(ScratchieConstants.ATTR_USER_UID); + // in case of the leader we should let all other learners see Next Activity button + ScratchieSession toolSession = LearningAction.service.getScratchieSessionBySessionId(toolSessionId); + if (toolSession.isUserGroupLeader(userUid) && !toolSession.isScratchingFinished()) { + tryExecute(new Callable() { + @Override + public Object call() throws ScratchieApplicationException { + LearningAction.service.setScratchingFinished(toolSessionId); + return null; + } + }); + } + + return mapping.findForward(ScratchieConstants.SUCCESS); + } + /** + * Submit reflection form input database. Only leaders can submit reflections. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws ScratchieApplicationException + */ + private ActionForward saveBurningQuestions(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws ScratchieApplicationException { + initializeScratchieService(); + + String sessionMapID = WebUtil.readStrParam(request, ScratchieConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute( + sessionMapID); + Scratchie scratchie = (Scratchie) sessionMap.get(ScratchieConstants.ATTR_SCRATCHIE); + final Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); + Collection items = (Collection) sessionMap.get(ScratchieConstants.ATTR_ITEM_LIST); + + for (int i = 0; i < items.size(); i++) { + final Long itemUid = WebUtil.readLongParam(request, ScratchieConstants.ATTR_ITEM_UID + i); + ScratchieItem item = null; + for (ScratchieItem itemIter : items) { + if (itemIter.getUid().equals(itemUid)) { + item = itemIter; + break; + } + } + + final String question = request.getParameter(ScratchieConstants.ATTR_BURNING_QUESTION_PREFIX + i); + //question = question.replaceAll("[\n\r\f]", ""); + + //if burning question is not blank save it + if (StringUtils.isNotBlank(question)) { + + //skip updating if the value wasn't changed + if (item.getBurningQuestion() != null && item.getBurningQuestion().equals(question)) { + continue; + } + + // update new entry + tryExecute(new Callable() { + @Override + public Object call() throws ScratchieApplicationException { + LearningAction.service.saveBurningQuestion(sessionId, itemUid, question); + return null; + } + }); + + //update question in sessionMap + item.setBurningQuestion(question); + } + + } + + boolean isNotebookSubmitted = sessionMap.get(ScratchieConstants.ATTR_REFLECTION_ENTRY) != null; + if (scratchie.isReflectOnActivity() && !isNotebookSubmitted) { + return newReflection(mapping, form, request, response); + } else { + return showResults(mapping, form, request, response); + } + + } + + /** * Display empty reflection form. * * @param mapping @@ -569,7 +703,7 @@ }); } - return mapping.findForward(ScratchieConstants.SUCCESS); + return mapping.findForward(ScratchieConstants.NOTEBOOK); } /** Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/form/ScratchieForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/form/ScratchieForm.java,v diff -u -r1.5 -r1.6 --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/form/ScratchieForm.java 17 Jan 2014 22:12:29 -0000 1.5 +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/form/ScratchieForm.java 11 Feb 2015 23:00:52 -0000 1.6 @@ -32,7 +32,6 @@ import org.lamsfoundation.lams.tool.scratchie.model.Scratchie; /** - * * Scratchie Form. * * @struts.form name="scratchieForm" @@ -72,6 +71,7 @@ scratchie.setDefineLater(false); scratchie.setReflectOnActivity(false); scratchie.setExtraPoint(false); + scratchie.setBurningQuestionsEnabled(true); } } Index: lams_tool_scratchie/web/pages/authoring/advance.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/web/pages/authoring/advance.jsp,v diff -u -r1.6 -r1.7 --- lams_tool_scratchie/web/pages/authoring/advance.jsp 16 Jun 2014 14:29:08 -0000 1.6 +++ lams_tool_scratchie/web/pages/authoring/advance.jsp 11 Feb 2015 23:00:52 -0000 1.7 @@ -15,6 +15,13 @@ + + + + + + + Index: lams_tool_scratchie/web/pages/learning/burningQuestions.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/web/pages/learning/burningQuestions.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_scratchie/web/pages/learning/burningQuestions.jsp 11 Feb 2015 23:00:52 -0000 1.1 @@ -0,0 +1,67 @@ + + +<%@ include file="/common/taglibs.jsp"%> +<%-- param has higher level for request attribute --%> + + + + + + + + + + + + + <%@ include file="/common/header.jsp"%> + + + + + + + + + + + + : + + + + + + + + ${item.burningQuestion} + + + + + + + + + + + + + + + + + + Index: lams_tool_scratchie/web/pages/learning/learning.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/web/pages/learning/learning.jsp,v diff -u -r1.19 -r1.20 --- lams_tool_scratchie/web/pages/learning/learning.jsp 19 Sep 2014 13:37:41 -0000 1.19 +++ lams_tool_scratchie/web/pages/learning/learning.jsp 11 Feb 2015 23:00:52 -0000 1.20 @@ -59,22 +59,18 @@ }); } - function finish(){ + function finish(method){ var numberOfAvailableScratches = $("[id^=imageLink-][onclick]").length; var finishConfirmed = (numberOfAvailableScratches > 0) ? confirm("") : true; if (finishConfirmed) { document.getElementById("finishButton").disabled = true; - document.location.href =''; + document.location.href =''; return false; } } - function continueReflect(){ - document.location.href=''; - } - var refreshIntervalId = null; if (${!isUserLeader && mode != "teacher"}) { refreshIntervalId = setInterval("refreshQuestionList();",3000);// Auto-Refresh every 3 seconds Index: lams_tool_scratchie/web/pages/learning/questionlist.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/web/pages/learning/questionlist.jsp,v diff -u -r1.12 -r1.13 --- lams_tool_scratchie/web/pages/learning/questionlist.jsp 8 Apr 2014 01:00:39 -0000 1.12 +++ lams_tool_scratchie/web/pages/learning/questionlist.jsp 11 Feb 2015 23:00:52 -0000 1.13 @@ -55,83 +55,88 @@ } - - - + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - ${answer.attemptOrder} - - - - + + + + ${answer.attemptOrder} + + + + - - ${answer.description} - - - - - + + ${answer.description} + + + + + - <%-- show reflection (only for teacher) --%> - - - +<%-- show reflection (only for teacher) --%> + + + + + + + + + - + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + - + - - + + Index: lams_tool_scratchie/web/pages/learning/results.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/web/pages/learning/results.jsp,v diff -u -r1.13 -r1.14 --- lams_tool_scratchie/web/pages/learning/results.jsp 6 Jun 2014 20:05:49 -0000 1.13 +++ lams_tool_scratchie/web/pages/learning/results.jsp 11 Feb 2015 23:00:52 -0000 1.14 @@ -83,6 +83,9 @@ function continueReflect(){ document.location.href=''; } + function editBurningQuestions(){ + document.location.href=''; + } @@ -112,7 +115,39 @@ ${score}% + + + + : + + + + + + + + + + + - + + + + + + + + + + + + + + + + + : Index: lams_tool_scratchie/web/pages/monitoring/parts/advanceOptions.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/web/pages/monitoring/parts/advanceOptions.jsp,v diff -u -r1.5 -r1.6 --- lams_tool_scratchie/web/pages/monitoring/parts/advanceOptions.jsp 1 Apr 2014 02:28:49 -0000 1.5 +++ lams_tool_scratchie/web/pages/monitoring/parts/advanceOptions.jsp 11 Feb 2015 23:00:52 -0000 1.6 @@ -19,7 +19,7 @@ - + @@ -31,12 +31,29 @@ + + + + + + + + + + + + + + + + + - + @@ -47,7 +64,7 @@ - +
+ + + + +
Index: lams_tool_scratchie/web/pages/learning/burningQuestions.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/web/pages/learning/burningQuestions.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_scratchie/web/pages/learning/burningQuestions.jsp 11 Feb 2015 23:00:52 -0000 1.1 @@ -0,0 +1,67 @@ + + +<%@ include file="/common/taglibs.jsp"%> +<%-- param has higher level for request attribute --%> + + + + + + + + + + + + + <%@ include file="/common/header.jsp"%> + + + + + + + + + + + + : + + + + + + + + ${item.burningQuestion} + + + + + + + + + + + + + + + + + + Index: lams_tool_scratchie/web/pages/learning/learning.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/web/pages/learning/learning.jsp,v diff -u -r1.19 -r1.20 --- lams_tool_scratchie/web/pages/learning/learning.jsp 19 Sep 2014 13:37:41 -0000 1.19 +++ lams_tool_scratchie/web/pages/learning/learning.jsp 11 Feb 2015 23:00:52 -0000 1.20 @@ -59,22 +59,18 @@ }); } - function finish(){ + function finish(method){ var numberOfAvailableScratches = $("[id^=imageLink-][onclick]").length; var finishConfirmed = (numberOfAvailableScratches > 0) ? confirm("") : true; if (finishConfirmed) { document.getElementById("finishButton").disabled = true; - document.location.href =''; + document.location.href =''; return false; } } - function continueReflect(){ - document.location.href=''; - } - var refreshIntervalId = null; if (${!isUserLeader && mode != "teacher"}) { refreshIntervalId = setInterval("refreshQuestionList();",3000);// Auto-Refresh every 3 seconds Index: lams_tool_scratchie/web/pages/learning/questionlist.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/web/pages/learning/questionlist.jsp,v diff -u -r1.12 -r1.13 --- lams_tool_scratchie/web/pages/learning/questionlist.jsp 8 Apr 2014 01:00:39 -0000 1.12 +++ lams_tool_scratchie/web/pages/learning/questionlist.jsp 11 Feb 2015 23:00:52 -0000 1.13 @@ -55,83 +55,88 @@ } - - - + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - ${answer.attemptOrder} - - - - + + + + ${answer.attemptOrder} + + + + - - ${answer.description} - - - - - + + ${answer.description} + + + + + - <%-- show reflection (only for teacher) --%> - - - +<%-- show reflection (only for teacher) --%> + + + + + + + + + - + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + - + - - + + Index: lams_tool_scratchie/web/pages/learning/results.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/web/pages/learning/results.jsp,v diff -u -r1.13 -r1.14 --- lams_tool_scratchie/web/pages/learning/results.jsp 6 Jun 2014 20:05:49 -0000 1.13 +++ lams_tool_scratchie/web/pages/learning/results.jsp 11 Feb 2015 23:00:52 -0000 1.14 @@ -83,6 +83,9 @@ function continueReflect(){ document.location.href=''; } + function editBurningQuestions(){ + document.location.href=''; + } @@ -112,7 +115,39 @@ ${score}% + + + + : + + + + + + + + + + + - + + + + + + + + + + + + + + + + + : Index: lams_tool_scratchie/web/pages/monitoring/parts/advanceOptions.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/web/pages/monitoring/parts/advanceOptions.jsp,v diff -u -r1.5 -r1.6 --- lams_tool_scratchie/web/pages/monitoring/parts/advanceOptions.jsp 1 Apr 2014 02:28:49 -0000 1.5 +++ lams_tool_scratchie/web/pages/monitoring/parts/advanceOptions.jsp 11 Feb 2015 23:00:52 -0000 1.6 @@ -19,7 +19,7 @@ - + @@ -31,12 +31,29 @@ + + + + + + + + + + + + + + + + + - + @@ -47,7 +64,7 @@ - +
+ +
- + +
- - -
- -