Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McApplicationException.java =================================================================== diff -u -rb7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McApplicationException.java (.../McApplicationException.java) (revision b7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McApplicationException.java (.../McApplicationException.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -24,7 +24,7 @@ /** - *

This exception wraps all basic exception occured in the qa tool. It is + *

This exception wraps all basic exception occured in the mcq tool. It is * not suppose to be try and catched in any level. The struts should be taking * care of handling this exception.

* Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McComparator.java =================================================================== diff -u -rb7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McComparator.java (.../McComparator.java) (revision b7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McComparator.java (.../McComparator.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -27,12 +27,6 @@ /** * @author Ozgur Demirtas - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ - -/** * A comparator implementation that can be used as a constructor to collections. * The TreeMap in the web layer makes use of it. * Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McContent.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McContent.java (.../McContent.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McContent.java (.../McContent.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -31,7 +31,14 @@ import org.apache.commons.lang.builder.ToStringBuilder; -/** @author Ozgur Demirtas */ +/** + *

Persistent object/bean that defines the content for the MCQ tool. + * Provides accessors and mutators to get/set attributes + * It maps to database table: tl_lamc11_content + *

+ * + * @author Ozgur Demirtas + */ public class McContent implements Serializable { /** identifier field */ Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McOptsContent.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McOptsContent.java (.../McOptsContent.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McOptsContent.java (.../McOptsContent.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -29,7 +29,14 @@ import org.apache.commons.lang.builder.ToStringBuilder; -/** @author Ozgur Demirtas */ +/** + *

Persistent object/bean that defines the content for the MCQ tool. + * Provides accessors and mutators to get/set attributes + * It maps to database table: tl_lamc11_options_content + *

+ * + * @author Ozgur Demirtas + */ public class McOptsContent implements Serializable { /** identifier field */ Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McQueContent.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McQueContent.java (.../McQueContent.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McQueContent.java (.../McQueContent.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -30,7 +30,14 @@ import org.apache.commons.lang.builder.ToStringBuilder; -/** @author Ozgur Demirtas */ +/** + *

Persistent object/bean that defines the question content for the MCQ tool. + * Provides accessors and mutators to get/set attributes + * It maps to database table: tl_lamc11_que_content + *

+ * + * @author Ozgur Demirtas + */ public class McQueContent implements Serializable { /** identifier field */ Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McQueUsr.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McQueUsr.java (.../McQueUsr.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McQueUsr.java (.../McQueUsr.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -29,7 +29,14 @@ import org.apache.commons.lang.builder.ToStringBuilder; -/** @author Ozgur Demirtas */ +/** + *

Persistent object/bean that defines the user for the MCQ tool. + * Provides accessors and mutators to get/set attributes + * It maps to database table: tl_lamc11_que_usr + *

+ * + * @author Ozgur Demirtas + */ public class McQueUsr implements Serializable { /** identifier field */ Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McSession.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McSession.java (.../McSession.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McSession.java (.../McSession.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -30,7 +30,14 @@ import org.apache.commons.lang.builder.ToStringBuilder; -/** @author Ozgur Demirtas */ +/** + *

Persistent object/bean that defines the content for the MCQ tool. + * Provides accessors and mutators to get/set attributes + * It maps to database table: tl_lamc11_session + *

+ * + * @author Ozgur Demirtas + */ public class McSession implements Serializable { public final static String INCOMPLETE = "INCOMPLETE"; Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McStringComparator.java =================================================================== diff -u -rb7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McStringComparator.java (.../McStringComparator.java) (revision b7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McStringComparator.java (.../McStringComparator.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -30,13 +30,7 @@ /** * @author Ozgur Demirtas - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ - -/** - * A comparator implementation that can be used as a constructor to collections. + * * A comparator implementation that can be used as a constructor to collections. * The TreeMap in the web layer makes use of it. * */ Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUploadedFile.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUploadedFile.java (.../McUploadedFile.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUploadedFile.java (.../McUploadedFile.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -25,10 +25,13 @@ import org.apache.commons.lang.builder.ToStringBuilder; /** + *

Persistent object/bean that defines the uploaded file for the MCQ tool. + * Provides accessors and mutators to get/set attributes + * It maps to database table: tl_lamc11_uploadedFile + *

* * @author Ozgur Demirtas */ - public class McUploadedFile implements Serializable { /** identifier field */ Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUsrAttempt.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUsrAttempt.java (.../McUsrAttempt.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUsrAttempt.java (.../McUsrAttempt.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -27,7 +27,14 @@ import org.apache.commons.lang.builder.ToStringBuilder; -/** @author Ozgur Demirtas */ +/** + *

Persistent object/bean that defines the user attempt for the MCQ tool. + * Provides accessors and mutators to get/set attributes + * It maps to database table: tl_lamc11_usr_attempt + *

+ * + * @author Ozgur Demirtas + */ public class McUsrAttempt implements Serializable { /** identifier field */ Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java =================================================================== diff -u -re69d075821d086db03316c2f15e6e1d74aba165f -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java (.../McUtils.java) (revision e69d075821d086db03316c2f15e6e1d74aba165f) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java (.../McUtils.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -1,8 +1,6 @@ /* * Created on 21/04/2005 * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates */ package org.lamsfoundation.lams.tool.mc; @@ -35,18 +33,19 @@ /** * @author Ozgur Demirtas - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * Common MCQ utility functions live here. */ - -/** - * Common utility functions live here. - */ public abstract class McUtils implements McAppConstants { static Logger logger = Logger.getLogger(McUtils.class.getName()); - + + /** + * returns the service object from the session cache + * IMcService getToolService(HttpServletRequest request) + * + * @param request + * @return + */ public static IMcService getToolService(HttpServletRequest request) { IMcService mcService=(IMcService)request.getSession().getAttribute(TOOL_SERVICE); @@ -55,87 +54,6 @@ /** - * generateId() - * return long - * IMPORTANT: The way we obtain either content id or tool session id must be modified - * so that we only use lams common to get these ids. This functionality is not - * available yet in the lams common as of 21/04/2005. - */ - public static long generateId() - { - Random generator = new Random(); - long longId=generator.nextLong(); - if (longId < 0) longId=longId * (-1) ; - return longId; - } - - /** - * helps create a mock user object in development time. - * static long generateIntegerId() - * @return long - */ - public static int generateIntegerId() - { - Random generator = new Random(); - int intId=generator.nextInt(); - if (intId < 0) intId=intId * (-1) ; - return intId; - } - - - public static int getCurrentUserId(HttpServletRequest request) throws McApplicationException - { - HttpSession ss = SessionManager.getSession(); - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - logger.debug(logger + " " + "McUtils" + " Current user is: " + user + " with id: " + user.getUserID()); - return user.getUserID().intValue(); - } - - - /** - * This method exists temporarily until we have the user data is passed properly from teh container to the tool - * createMockUser() - * @return User - */ - public static User createMockUser() - { - logger.debug(logger + " " + "McUtils" + " request for new new mock user"); - int randomUserId=generateIntegerId(); - User mockUser=new User(); - mockUser.setUserId(new Integer(randomUserId)); - mockUser.setFirstName(MOCK_USER_NAME + randomUserId); - mockUser.setLastName(MOCK_USER_LASTNAME + randomUserId); - mockUser.setLogin(MOCK_LOGIN_NAME + randomUserId); //we assume login and username refers to the same property - logger.debug(logger + " " + "McUtils" + " created mockuser: " + mockUser); - return mockUser; - } - - public static User createSimpleUser(Integer userId) - { - User user=new User(); - user.setUserId(userId); - return user; - } - - public static User createUser(Integer userId) - { - User user=new User(); - user.setUserId(userId); - - int randomUserId=generateIntegerId(); - user.setFirstName(MOCK_USER_NAME + randomUserId); - user.setLastName(MOCK_USER_LASTNAME + randomUserId); - user.setLogin(MOCK_LOGIN_NAME + randomUserId); - return user; - } - - public static boolean getDefineLaterStatus() - { - return false; - } - - - /** * existsContent(long toolContentId) * @param long toolContentId * @return boolean @@ -716,5 +634,97 @@ } } + + + /** + * temporary function + * @return + */ + public static long generateId() + { + Random generator = new Random(); + long longId=generator.nextLong(); + if (longId < 0) longId=longId * (-1) ; + return longId; + } + + /** + * temporary function + * @return + */ + public static int generateIntegerId() + { + Random generator = new Random(); + int intId=generator.nextInt(); + if (intId < 0) intId=intId * (-1) ; + return intId; + } + + + /** + * temporary function + * @return + */ + public static int getCurrentUserId(HttpServletRequest request) throws McApplicationException + { + HttpSession ss = SessionManager.getSession(); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + logger.debug(logger + " " + "McUtils" + " Current user is: " + user + " with id: " + user.getUserID()); + return user.getUserID().intValue(); + } + + + /** + * temporary function + * @return + */ + public static User createMockUser() + { + logger.debug(logger + " " + "McUtils" + " request for new new mock user"); + int randomUserId=generateIntegerId(); + User mockUser=new User(); + mockUser.setUserId(new Integer(randomUserId)); + mockUser.setFirstName(MOCK_USER_NAME + randomUserId); + mockUser.setLastName(MOCK_USER_LASTNAME + randomUserId); + mockUser.setLogin(MOCK_LOGIN_NAME + randomUserId); //we assume login and username refers to the same property + logger.debug(logger + " " + "McUtils" + " created mockuser: " + mockUser); + return mockUser; + } + + /** + * temporary function + * @return + */ + public static User createSimpleUser(Integer userId) + { + User user=new User(); + user.setUserId(userId); + return user; + } + + /** + * temporary function + * @return + */ + public static User createUser(Integer userId) + { + User user=new User(); + user.setUserId(userId); + int randomUserId=generateIntegerId(); + user.setFirstName(MOCK_USER_NAME + randomUserId); + user.setLastName(MOCK_USER_LASTNAME + randomUserId); + user.setLogin(MOCK_LOGIN_NAME + randomUserId); + return user; + } + + /** + * temporary function + * @return + */ + public static boolean getDefineLaterStatus() + { + return false; + } + } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcContentDAO.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcContentDAO.java (.../IMcContentDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcContentDAO.java (.../IMcContentDAO.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -28,13 +28,11 @@ import org.lamsfoundation.lams.tool.mc.McSession; /** - *

Interface for the McContent DAO, defines methods needed to access/modify - * mc content

- * @author ozgurd + * @author Ozgur Demirtas + *

Interface for the McContent DAO, defines methods needed to access/modify mc content

+ * */ public interface IMcContentDAO { - - /** *

Return the persistent instance of a McContent * with the given identifier uid, returns null if not found.

@@ -115,5 +113,4 @@ public List findAll(Class objClass); public void flush(); - } \ No newline at end of file Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java (.../IMcOptionsContentDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java (.../IMcOptionsContentDAO.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -26,11 +26,10 @@ import org.lamsfoundation.lams.tool.mc.McOptsContent; - /** + * @author Ozgur Demirtas + *

Interface for the McOptionsContent DAO, defines methods needed to access/modify mc options content

* - * @author ozgurd - * */ public interface IMcOptionsContentDAO { Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java (.../IMcQueContentDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java (.../IMcQueContentDAO.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -29,7 +29,8 @@ /** * - * @author ozgurd + * @author Ozgur Demirtas + *

Interface for the McQueContent DAO, defines methods needed to access/modify mc question content

* */ public interface IMcQueContentDAO Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcSessionDAO.java =================================================================== diff -u -rb7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcSessionDAO.java (.../IMcSessionDAO.java) (revision b7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcSessionDAO.java (.../IMcSessionDAO.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -30,9 +30,9 @@ /** - *

Interface for the McSession DAO, defines methods needed to access/modify - * mc session

- * @author ozgurd + * @author Ozgur Demirtas + *

Interface for the McSession DAO, defines methods needed to access/modify mc session

+ * */ public interface IMcSessionDAO { Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUploadedFileDAO.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUploadedFileDAO.java (.../IMcUploadedFileDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUploadedFileDAO.java (.../IMcUploadedFileDAO.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -27,6 +27,7 @@ /** * * @author Ozgur Demirtas + *

Interface for the McUploadedFile DAO, defines methods needed to access/modify mc uploadedFile content

* */ public interface IMcUploadedFileDAO Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java (.../IMcUserDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java (.../IMcUserDAO.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -27,10 +27,8 @@ import org.lamsfoundation.lams.tool.mc.McSession; /** - * @author ozgurd - * - *

Interface for the McSession DAO, defines methods needed to access/modify - * mc users (learners of the mc activity)

+ * @author Ozgur Demirtas + *

Interface for the McUser DAO, defines methods needed to access/modify user data

*/ public interface IMcUserDAO { Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java (.../IMcUsrAttemptDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java (.../IMcUsrAttemptDAO.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -27,7 +27,8 @@ /** * - * @author ozgurd + * @author Ozgur Demirtas + * *

Interface for the McUsrAttempt DAO, defines methods needed to access/modify user attempt data

* */ public interface IMcUsrAttemptDAO Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McContentDAO.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McContentDAO.java (.../McContentDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McContentDAO.java (.../McContentDAO.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -35,7 +35,7 @@ import org.springframework.orm.hibernate3.support.HibernateDaoSupport; /** - * @author ozgurd + * @author Ozgur Demirtas *

Hibernate implementation for database access to McContent for the mc tool.

*/ Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java (.../McOptionsContentDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java (.../McOptionsContentDAO.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -33,11 +33,9 @@ /** - * @author ozgurd - * + * @author Ozgur Demirtas *

Hibernate implementation for database access to McOptionsContent for the mc tool.

*/ - public class McOptionsContentDAO extends HibernateDaoSupport implements IMcOptionsContentDAO { static Logger logger = Logger.getLogger(McOptionsContentDAO.class.getName()); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -44,10 +44,9 @@ /** - * This interface define the contract that all MCQ service provider must - * follow. + * @author Ozgur Demirtas * - * @author ozgurd + * Interface that defines the contract that all MCQ service provider must follow. */ public interface IMcService { Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -71,22 +71,15 @@ import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; import org.springframework.dao.DataAccessException; - - /** - * The POJO implementation of Mc service. All business logics of survey tool - * are implemented in this class. It translate the request from presentation - * layer and perform approporiate database operation. * + * @author Ozgur Demirtas * - * Every method is implemented as a Hibernate session transaction. It open an - * new persistent session or connect to existing persistent session in the - * begining and it close or disconnect to the persistent session in the end. + * The POJO implementation of Mc service. All business logics of MCQ tool + * are implemented in this class. It translate the request from presentation + * layer and perform appropriate database operation. * - * @author ozgurd - * */ - public class McServicePOJO implements IMcService, ToolContentManager, ToolSessionManager, McAppConstants Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServiceProxy.java =================================================================== diff -u -rb7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServiceProxy.java (.../McServiceProxy.java) (revision b7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServiceProxy.java (.../McServiceProxy.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -33,22 +33,21 @@ /** + * @author Ozgur Demirtas + * *

This class act as the proxy between web layer and service layer. It is * designed to decouple the presentation logic and business logic completely. * In this way, the presentation tier will no longer be aware of the changes in * service layer. Therefore we can feel free to switch the business logic * implementation.

- * - * @author ozgurd - * */ public class McServiceProxy { /** - * Return the qa domain service object. It will delegate to the Spring + * Return the mc domain service object. It will delegate to the Spring * helper method to retrieve the proper bean from Spring bean factory. * @param servletContext the servletContext for current application - * @return survey service object. + * @return mcq service object. */ public static final IMcService getMcService(ServletContext servletContext) { Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java =================================================================== diff -u -r735c5db341aaba22874662bf7e44ec91a24424c7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 735c5db341aaba22874662bf7e44ec91a24424c7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -1,8 +1,5 @@ /* * Created on 16/05/2005 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates */ package org.lamsfoundation.lams.tool.mc.web; @@ -31,6 +28,269 @@ public class AuthoringUtil implements McAppConstants { static Logger logger = Logger.getLogger(AuthoringUtil.class.getName()); + public static Map repopulateCurrentCheckBoxStatesMap(HttpServletRequest request) + { + Map mapTempContent= new TreeMap(new McComparator()); + + long mapCounter=0; + for (long i=1; i <= MAX_OPTION_COUNT ; i++) + { + String candidateEntry =request.getParameter("checkBoxSelected" + i); + String optionText =request.getParameter("optionContent" + i); + + if ( + (candidateEntry != null) && + (candidateEntry.length() > 0) + ) + { + if (candidateEntry.equals("Correct")) + { + mapCounter++; + mapTempContent.put(new Long(mapCounter).toString(), optionText); + } + } + } + logger.debug("return repopulated currentCheckBoxStatesMap: " + mapTempContent); + return mapTempContent; + } + + + public static boolean verifyDuplicatesOptionsMap(Map mapOptionsContent) + { + Map originalMapOptionsContent=mapOptionsContent; + Map backupMapOptionsContent=mapOptionsContent; + + int optionCount=0; + for (long i=1; i <= MAX_OPTION_COUNT ; i++) + { + String currentOption=(String)originalMapOptionsContent.get(new Long(i).toString()); + logger.debug("verified currentOption " + currentOption); + + optionCount=0; + for (long j=1; j <= MAX_OPTION_COUNT ; j++) + { + String backedOption=(String)backupMapOptionsContent.get(new Long(j).toString()); + + if ((currentOption != null) && (backedOption !=null)) + { + if (currentOption.equals(backedOption)) + { + optionCount++; + logger.debug("optionCount for " + currentOption + " is: " + optionCount); + } + + if (optionCount > 1) + return false; + } + } + } + return true; + } + + + public static boolean validateQuestionsNotEmpty(Map mapQuestionsContent) + { + Iterator itMap = mapQuestionsContent.entrySet().iterator(); + while (itMap.hasNext()) { + Map.Entry pairs = (Map.Entry)itMap.next(); + logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); + + if ((pairs.getValue() != null) && (pairs.getValue().toString().length() == 0)) + return false; + + } + return true; + } + + public static Map repopulateCurrentWeightsMap(HttpServletRequest request, String parameterType) + { + Map mapTempQuestionsContent= new TreeMap(new McComparator()); + logger.debug("parameterType: " + parameterType); + + long mapCounter=0; + for (long i=1; i <= MAX_QUESTION_COUNT ; i++) + { + String candidateEntry =request.getParameter(parameterType + i); + String questionText =request.getParameter("questionContent" + i); + if ((questionText != null) && (questionText.length() > 0)) + { + logger.debug("questionText: " + questionText); + if (candidateEntry != null) + { + mapCounter++; + mapTempQuestionsContent.put(new Long(mapCounter).toString(), candidateEntry); + } + } + + } + logger.debug("return repopulated Map: " + mapTempQuestionsContent); + return mapTempQuestionsContent; + } + + + /** + * shrinks the size of the Map to only used entries + * + * @param mapQuestionContent + * @param request + * @return + */ + public static Map repopulateMap(HttpServletRequest request, String parameterType) + { + Map mapTempQuestionsContent= new TreeMap(new McComparator()); + logger.debug("parameterType: " + parameterType); + + long mapCounter=0; + for (long i=1; i <= MAX_QUESTION_COUNT ; i++) + { + String candidateEntry =request.getParameter(parameterType + i); + if ( + (candidateEntry != null) && + (candidateEntry.length() > 0) + ) + { + mapCounter++; + mapTempQuestionsContent.put(new Long(mapCounter).toString(), candidateEntry); + } + } + logger.debug("return repopulated Map: " + mapTempQuestionsContent); + return mapTempQuestionsContent; + } + + + public static Map shiftMap(Map mapQuestionsContent, String questionIndex , String movableQuestionEntry, String direction) + { + logger.debug("movableQuestionEntry: " + movableQuestionEntry); + /* map to be returned */ + Map mapTempQuestionsContent= new TreeMap(new McComparator()); + + Iterator itMap = mapQuestionsContent.entrySet().iterator(); + String shiftableEntry=null; + + int shiftableIndex=0; + if (direction.equals("down")) + { + logger.debug("moving map down"); + shiftableIndex=new Integer(questionIndex).intValue() + 1; + } + else + { + logger.debug("moving map up"); + shiftableIndex=new Integer(questionIndex).intValue() - 1; + + } + + logger.debug("shiftableIndex: " + shiftableIndex); + shiftableEntry=(String)mapQuestionsContent.get(new Integer(shiftableIndex).toString()); + logger.debug("shiftable entry: " + shiftableEntry); + + if (shiftableEntry != null) + { + Iterator itQuestionsMap = mapQuestionsContent.entrySet().iterator(); + long mapCounter=0; + while (itQuestionsMap.hasNext()) { + Map.Entry pairs = (Map.Entry)itQuestionsMap.next(); + logger.debug("comparing the pair: " + pairs.getKey() + " = " + pairs.getValue()); + mapCounter++; + logger.debug("mapCounter: " + mapCounter); + + if (!pairs.getKey().equals(questionIndex) && !pairs.getKey().equals(new Integer(shiftableIndex).toString())) + { + logger.debug("normal copy " + questionIndex); + mapTempQuestionsContent.put(new Long(mapCounter).toString(), pairs.getValue()); + } + else if (pairs.getKey().equals(questionIndex)) + { + logger.debug("move type 1 " + questionIndex); + mapTempQuestionsContent.put(new Long(mapCounter).toString(), shiftableEntry); + } + else if (pairs.getKey().equals(new Integer(shiftableIndex).toString())) + { + logger.debug("move type 2 " + shiftableIndex); + mapTempQuestionsContent.put(new Long(mapCounter).toString(), movableQuestionEntry); + } + } + } + else + { + logger.debug("no change to map"); + mapTempQuestionsContent=mapQuestionsContent; + } + return mapTempQuestionsContent; + } + + + public static boolean validateTotalWeight(HttpServletRequest request) + { + Map mapWeights= repopulateCurrentWeightsMap(request, "questionWeight"); + logger.debug("mapWeights: " + mapWeights); + + Iterator itMap = mapWeights.entrySet().iterator(); + int totalWeight=0; + while (itMap.hasNext()) { + Map.Entry pairs = (Map.Entry)itMap.next(); + logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); + + if ((pairs.getValue() != null) || (pairs.getValue().toString().length() > 0)) + { + totalWeight=totalWeight+ new Integer(pairs.getValue().toString()).intValue(); + } + } + + logger.debug("totalWeight: " + totalWeight); + + if (totalWeight != 100) + { + return false; + } + + return true; + } + + + public static boolean validateSubTotalWeights(HttpServletRequest request, McAuthoringForm mcAuthoringForm) + { + Map mapWeights= repopulateCurrentWeightsMap(request, "questionWeight"); + logger.debug("mapWeights: " + mapWeights); + + int totalWeight=0; + Iterator itMap = mapWeights.entrySet().iterator(); + while (itMap.hasNext()) { + Map.Entry pairs = (Map.Entry)itMap.next(); + logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); + + int currentWeight=new Integer(pairs.getValue().toString()).intValue(); + totalWeight= totalWeight + currentWeight; + logger.debug("sub totalWeight: " + totalWeight); + } + logger.debug("final totalWeight: " + totalWeight); + + if (totalWeight > 100) + return false; + else + return true; + } + + + public static boolean validateOptions(HttpServletRequest request) + { + logger.debug("will validateOptions"); + String parameterType="checkBoxSelected"; + for (int i=1; i <= MAX_OPTION_COUNT ; i++) + { + String isCorrect=request.getParameter(parameterType + i); + logger.debug("isCorrect: " + isCorrect); + + if (isCorrect != null) + { + if (isCorrect.equals("Correct")) + return true; + } + } + return false; + } + + public Map rebuildQuestionMapfromDB(HttpServletRequest request, Long toolContentId) { Map mapQuestionsContent= new TreeMap(new McComparator()); @@ -136,5 +396,4 @@ } logger.debug("end of simulating setAsDefineLater on content id: " + toolContentId); } - } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java =================================================================== diff -u -r66e72872d1d3cdb236fce53f721ede405249ab50 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 66e72872d1d3cdb236fce53f721ede405249ab50) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -55,114 +55,9 @@ import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; - /** + * * @author Ozgur Demirtas * - * change the logic about completion status - * - */ - -/** - * - * once lams_learning is ready and appContext file is src/ then FINISH toool session will work. - * - */ - -/** - * - * done: removed styling, except error messages and table centering - * - */ - -/** - * The tool's Spring configuration file: qaCompactApplicationContext.xml - * Main service bean of the tool is: org.lamsfoundation.lams.tool.qa.service.McServicePOJO - * - * done: config file is read from classpath - */ - - -/** - * - * the tool's web.xml will be modified to have classpath to learning service. - * This is how the tool gets the definition of "learnerService" - */ - -/** - * - * when to reset define later and synchin monitor etc.. - * - */ - -/** make sure the tool gets called on: - * setAsForceComplete(Long userId) throws McApplicationException - */ - - -/** - * - * User Issue: - * Right now: - * 1- the tool gets the request object from the container. - * 2- Principal principal = req.getUserPrincipal(); - * 3- String username = principal.getName(); - * 4- User userCompleteData = qaService.getCurrentUserData(userName); - * 5- write back userCompleteData.getUserId() - */ - - -/** - * - * JBoss Issue: - * Currently getUserPrincipal() returns null and ServletRequest.isUserInRole() always returns false on unsecured pages, - * even after the user has been authenticated. - * http://jira.jboss.com/jira/browse/JBWEB-19 - */ - - -/** - * eliminate calls: - * authoringUtil.simulatePropertyInspector_RunOffline(request); - * authoringUtil.simulatePropertyInspector_setAsDefineLater(request); - */ - - -/** - * - * @author ozgurd - * - * TOOL PARAMETERS: ?? (toolAccessMode) ?? - * Authoring environment: toolContentId - * Learning environment: toolSessionId + toolContentId - * Monitoring environment: toolContentId / Contribute tab:toolSessionId(s) - * - * - */ - -/** - * Note: the tool must support deletion of an existing content from within the authoring environment. - * The current support for this is by implementing the tool contract : removeToolContent(Long toolContentId) - */ - - -/** - * - * We have had to simulate container bahaviour in development stage by calling - * createToolSession and leaveToolSession from the web layer. These will go once the tool is - * in deployment environment. - * - * - * CHECK: leaveToolSession and relavent LearnerService may need to be defined in the spring config file. - * - */ - -/** - * - * GROUPING SUPPORT: Find out what to do. - */ - - -/** *

Action class that controls the logic of tool behavior.

* *

Note that Struts action class only has the responsibility to navigate @@ -176,10 +71,57 @@ * Struts action class as all of them are handled in * CustomStrutsExceptionHandler. * - * @author Ozgur Demirtas - */ + + + + + + + + + + +*/ public class McAction extends DispatchAction implements McAppConstants { + /* + * change the logic about completion status + + * once lams_learning is ready and appContext file is src/ then FINISH toool session will work. + * + * when to reset define later and synchin monitor etc.. + * + * make sure the tool gets called on: + * setAsForceComplete(Long userId) throws McApplicationException + * + * Note: the tool must support deletion of an existing content from within the authoring environment. + * The current support for this is by implementing the tool contract : removeToolContent(Long toolContentId) + */ static Logger logger = Logger.getLogger(McAction.class.getName()); /** @@ -295,84 +237,7 @@ return null; } - - protected Map rebuildQuestionMapfromDB(HttpServletRequest request) - { - Map mapQuestionsContent= new TreeMap(new McComparator()); - - IMcService mcService =McUtils.getToolService(request); - Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId:" + toolContentId); - - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); - - List list=mcService.getAllQuestionEntries(mcContent.getUid()); - logger.debug("list:" + list); - - Iterator listIterator=list.iterator(); - Long mapIndex=new Long(1); - while (listIterator.hasNext()) - { - McQueContent mcQueContent=(McQueContent)listIterator.next(); - logger.debug("mcQueContent:" + mcQueContent); - mapQuestionsContent.put(mapIndex.toString(),mcQueContent.getQuestion()); - mapIndex=new Long(mapIndex.longValue()+1); - } - - logger.debug("refreshed Map:" + mapQuestionsContent); - return mapQuestionsContent; - } - - - protected void removeRedundantQuestionEntries(HttpServletRequest request, Map mapQuestionsContent) - { - IMcService mcService =McUtils.getToolService(request); - - logger.debug("main Map mapQuestionsContent:" + mapQuestionsContent); - - Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId:" + toolContentId); - - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("mcContent:" + mcContent); - - if (mcContent != null) - { - List allQuestions=mcService.getAllQuestionEntries(mcContent.getUid()); - logger.debug("allQuestions:" + allQuestions); - - Iterator listIterator=allQuestions.iterator(); - - while (listIterator.hasNext()) - { - McQueContent mcQueContent=(McQueContent)listIterator.next(); - logger.debug("mcQueContent:" + mcQueContent); - - Iterator itQuestionsMap = mapQuestionsContent.entrySet().iterator(); - boolean matchFound=false; - while (itQuestionsMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itQuestionsMap.next(); - logger.debug("comparing the pair: " + pairs.getKey() + " = " + pairs.getValue()); - - if (pairs.getValue().toString().equals(mcQueContent.getQuestion())) - { - logger.debug("match found the pair: " + pairs.getValue().toString()); - matchFound=true; - } - } - - if (matchFound == false) - { - mcService.removeMcQueContent(mcQueContent); - logger.debug("removed mcQueContent: " + mcQueContent); - } - } - } - } - - /** * populates request parameters * populateParameters(HttpServletRequest request, McAuthoringForm mcAuthoringForm) @@ -399,19 +264,6 @@ mcAuthoringForm.setRemoveOption(null); mcAuthoringForm.setViewFileItem(null); - //mcAuthoringForm.setAddOption(null); - - /* - String addQuestion=request.getParameter("addQuestion"); - logger.debug("parameter addQuestion" + addQuestion); - if ((addQuestion != null) && addQuestion.equals("1")) - { - logger.debug("parameter addQuestion is selected " + addQuestion); - mcAuthoringForm.setAddQuestion("1"); - } - */ - - String editOptions=request.getParameter("editOptions"); logger.debug("parameter editOptions" + editOptions); if ((editOptions != null) && editOptions.equals("1")) @@ -444,16 +296,6 @@ mcAuthoringForm.setMoveUp("1"); } - /* - String addOption=request.getParameter("addOption"); - logger.debug("parameter addOption" + addOption); - if ((addOption != null) && addOption.equals("1")) - { - logger.debug("parameter addOption is selected " + addOption); - mcAuthoringForm.setAddOption("1"); - } - */ - String removeOption=request.getParameter("removeOption"); logger.debug("parameter removeOption" + removeOption); if ((removeOption != null) && removeOption.equals("1")) @@ -487,12 +329,12 @@ request.setAttribute(USER_ACTION, userAction); logger.debug("userAction:" + userAction); - Map mapQuestionsContent=repopulateMap(request, "questionContent"); + Map mapQuestionsContent=AuthoringUtil.repopulateMap(request, "questionContent"); logger.debug("mapQuestionsContent after shrinking: " + mapQuestionsContent); logger.debug("mapQuestionsContent size after shrinking: " + mapQuestionsContent.size()); logger.debug("will validate questions are not empty"); - boolean questionsNotEmptyValid=validateQuestionsNotEmpty(mapQuestionsContent); + boolean questionsNotEmptyValid=AuthoringUtil.validateQuestionsNotEmpty(mapQuestionsContent); logger.debug("questionsNotEmptyValid:" + questionsNotEmptyValid); if (questionsNotEmptyValid == false) { @@ -530,7 +372,7 @@ logger.debug("will validate SubTotalWeights"); - boolean subWeightsValid=validateSubTotalWeights(request,mcAuthoringForm); + boolean subWeightsValid=AuthoringUtil.validateSubTotalWeights(request,mcAuthoringForm); logger.debug("subWeightsValid:" + subWeightsValid); if (subWeightsValid == false) { @@ -552,7 +394,7 @@ } - Map mapWeights= repopulateMap(request, "questionWeight"); + Map mapWeights= AuthoringUtil.repopulateMap(request, "questionWeight"); request.getSession().setAttribute(MAP_WEIGHTS, mapWeights); System.out.print("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS)); @@ -587,11 +429,11 @@ request.setAttribute(USER_ACTION, userAction); logger.debug("userAction:" + userAction); - Map mapWeights= repopulateMap(request, "questionWeight"); + Map mapWeights= AuthoringUtil.repopulateMap(request, "questionWeight"); request.getSession().setAttribute(MAP_WEIGHTS, mapWeights); System.out.print("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS)); - Map mapQuestionsContent=repopulateMap(request, "questionContent"); + Map mapQuestionsContent=AuthoringUtil.repopulateMap(request, "questionContent"); logger.debug("mapQuestionsContent after shrinking: " + mapQuestionsContent); logger.debug("mapQuestionsContent size after shrinking: " + mapQuestionsContent.size()); @@ -649,12 +491,12 @@ request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(1)); logger.debug("setting EDIT_OPTIONS_MODE to 1"); - Map mapQuestionsContent=repopulateMap(request, "questionContent"); + Map mapQuestionsContent=AuthoringUtil.repopulateMap(request, "questionContent"); logger.debug("mapQuestionsContent after shrinking: " + mapQuestionsContent); logger.debug("mapQuestionsContent size after shrinking: " + mapQuestionsContent.size()); request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent); - Map mapWeights= repopulateMap(request, "questionWeight"); + Map mapWeights= AuthoringUtil.repopulateMap(request, "questionWeight"); request.getSession().setAttribute(MAP_WEIGHTS, mapWeights); System.out.print("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS)); @@ -886,6 +728,10 @@ } + + + + Map mapFeedbackIncorrect =(Map)request.getSession().getAttribute(MAP_FEEDBACK_INCORRECT); logger.debug("cached MAP_FEEDBACK_INCORRECT :" + mapFeedbackIncorrect); if (mapFeedbackIncorrect != null) @@ -940,11 +786,11 @@ request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(1)); logger.debug("setting EDIT_OPTIONS_MODE to 1"); - Map mapOptionsContent=repopulateMap(request,"optionContent"); + Map mapOptionsContent=AuthoringUtil.repopulateMap(request,"optionContent"); logger.debug("mapOptionsContent after shrinking: " + mapOptionsContent); logger.debug("mapOptionsContent size after shrinking: " + mapOptionsContent.size()); - boolean verifyDuplicatesOptionsMap=verifyDuplicatesOptionsMap(mapOptionsContent); + boolean verifyDuplicatesOptionsMap=AuthoringUtil.verifyDuplicatesOptionsMap(mapOptionsContent); logger.debug("verifyDuplicatesOptionsMap: " + verifyDuplicatesOptionsMap); if (verifyDuplicatesOptionsMap == false) { @@ -979,7 +825,7 @@ Map mapSelectedOptions= (Map) request.getSession().getAttribute(MAP_SELECTED_OPTIONS); mapSelectedOptions.clear(); - mapSelectedOptions = repopulateCurrentCheckBoxStatesMap(request); + mapSelectedOptions = AuthoringUtil.repopulateCurrentCheckBoxStatesMap(request); logger.debug("after add mapSelectedOptions: " + mapSelectedOptions); request.getSession().setAttribute(MAP_SELECTED_OPTIONS, mapSelectedOptions); @@ -1038,7 +884,7 @@ String optionIndex =mcAuthoringForm.getDeletableOptionIndex(); logger.debug("optionIndex:" + optionIndex); - Map mapOptionsContent=repopulateMap(request, "optionContent"); + Map mapOptionsContent=AuthoringUtil.repopulateMap(request, "optionContent"); logger.debug("mapOptionsContent after shrinking: " + mapOptionsContent); logger.debug("mapOptionsContent size after shrinking: " + mapOptionsContent.size()); int mapSize=mapOptionsContent.size(); @@ -1083,7 +929,7 @@ Map mapSelectedOptions= (Map) request.getSession().getAttribute(MAP_SELECTED_OPTIONS); mapSelectedOptions.clear(); - mapSelectedOptions = repopulateCurrentCheckBoxStatesMap(request); + mapSelectedOptions = AuthoringUtil.repopulateCurrentCheckBoxStatesMap(request); logger.debug("after add mapSelectedOptions: " + mapSelectedOptions); request.getSession().setAttribute(MAP_SELECTED_OPTIONS, mapSelectedOptions); @@ -1136,15 +982,15 @@ request.setAttribute(USER_ACTION, userAction); logger.debug("userAction:" + userAction); - Map mapQuestionsContent=repopulateMap(request, "questionContent"); + Map mapQuestionsContent=AuthoringUtil.repopulateMap(request, "questionContent"); logger.debug("mapQuestionsContent before move down: " + mapQuestionsContent); String questionIndex =mcAuthoringForm.getQuestionIndex(); logger.debug("questionIndex:" + questionIndex); String movableQuestionEntry=(String)mapQuestionsContent.get(questionIndex); logger.debug("movableQuestionEntry:" + movableQuestionEntry); - mapQuestionsContent= shiftMap(mapQuestionsContent, questionIndex,movableQuestionEntry, "down"); + mapQuestionsContent= AuthoringUtil.shiftMap(mapQuestionsContent, questionIndex,movableQuestionEntry, "down"); logger.debug("mapQuestionsContent after move down: " + mapQuestionsContent); request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent); @@ -1176,15 +1022,15 @@ request.setAttribute(USER_ACTION, userAction); logger.debug("userAction:" + userAction); - Map mapQuestionsContent=repopulateMap(request, "questionContent"); + Map mapQuestionsContent=AuthoringUtil.repopulateMap(request, "questionContent"); logger.debug("mapQuestionsContent before move down: " + mapQuestionsContent); String questionIndex =mcAuthoringForm.getQuestionIndex(); logger.debug("questionIndex:" + questionIndex); String movableQuestionEntry=(String)mapQuestionsContent.get(questionIndex); logger.debug("movableQuestionEntry:" + movableQuestionEntry); - mapQuestionsContent= shiftMap(mapQuestionsContent, questionIndex,movableQuestionEntry, "up"); + mapQuestionsContent= AuthoringUtil.shiftMap(mapQuestionsContent, questionIndex,movableQuestionEntry, "up"); logger.debug("mapQuestionsContent after move down: " + mapQuestionsContent); request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent); @@ -1218,7 +1064,7 @@ request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); logger.debug("setting EDIT_OPTIONS_MODE to 0"); - boolean validateOptions=validateOptions(request); + boolean validateOptions=AuthoringUtil.validateOptions(request); logger.debug("validateOptions:" + validateOptions); if (validateOptions == false) @@ -1235,7 +1081,7 @@ return (mapping.findForward(LOAD_QUESTIONS)); } - Map mapOptionsContent=repopulateMap(request, "optionContent"); + Map mapOptionsContent=AuthoringUtil.repopulateMap(request, "optionContent"); logger.debug("mapOptionsContent after shrinking: " + mapOptionsContent); request.getSession().setAttribute(MAP_OPTIONS_CONTENT, mapOptionsContent); logger.debug("final done MAP_OPTIONS_CONTENT: " + mapOptionsContent); @@ -1257,7 +1103,7 @@ Map mapSelectedOptions= (Map) request.getSession().getAttribute(MAP_SELECTED_OPTIONS); mapSelectedOptions.clear(); - mapSelectedOptions = repopulateCurrentCheckBoxStatesMap(request); + mapSelectedOptions = AuthoringUtil.repopulateCurrentCheckBoxStatesMap(request); logger.debug("after add mapSelectedOptions: " + mapSelectedOptions); request.getSession().setAttribute(MAP_SELECTED_OPTIONS, mapSelectedOptions); @@ -1304,7 +1150,7 @@ /** - * submits questions Map + * submits questions Map and persists questions as well as options information in the db. * submitQuestions(HttpServletRequest request, McAuthoringForm mcAuthoringForm, ActionMapping mapping) * * @param request @@ -1325,7 +1171,7 @@ ActionMessages errors= new ActionMessages(); - Map mapQuestionsContent=repopulateMap(request, "questionContent"); + Map mapQuestionsContent=AuthoringUtil.repopulateMap(request, "questionContent"); logger.debug("mapQuestionsContent before submit: " + mapQuestionsContent); request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent); @@ -1361,7 +1207,7 @@ return (mapping.findForward(LOAD_QUESTIONS)); } - boolean isTotalWeightsValid=validateTotalWeight(request); + boolean isTotalWeightsValid=AuthoringUtil.validateTotalWeight(request); logger.debug("isTotalWeightsValid:" + isTotalWeightsValid); if (isTotalWeightsValid == false) { @@ -1543,7 +1389,7 @@ logger.debug("richTextEndLearningMessage: " + richTextEndLearningMessage); - mapQuestionsContent=repopulateMap(request, "questionContent"); + mapQuestionsContent=AuthoringUtil.repopulateMap(request, "questionContent"); logger.debug("FINAL mapQuestionsContent after shrinking: " + mapQuestionsContent); logger.debug("mapQuestionsContent size after shrinking: " + mapQuestionsContent.size()); request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent); @@ -1624,7 +1470,7 @@ /** - * presents contents of uploaded files + * prepares data to view the contents of uploaded files * viewFileItem(HttpServletRequest request, McAuthoringForm mcAuthoringForm, ActionMapping mapping) * * @param request @@ -1736,6 +1582,7 @@ /** + * adds the offline file information in the content repository. * submitOfflineFiles(HttpServletRequest request, McAuthoringForm mcAuthoringForm, ActionMapping mapping) * * @param request @@ -1759,6 +1606,7 @@ } /** + * adds the online file information in the content repository. * submitOnlineFiles(HttpServletRequest request, McAuthoringForm mcAuthoringForm, ActionMapping mapping) * * @param request @@ -1789,6 +1637,17 @@ mcService.cleanAllQuestionsSimple(mcContent.getUid()); } + + /** + * creates the questions from the user in the db and makes a call to persist options. + * persistQuestions(HttpServletRequest request, Map mapQuestionsContent, Map mapFeedbackIncorrect, Map mapFeedbackCorrect, McContent mcContent) + * + * @param request + * @param mapQuestionsContent + * @param mapFeedbackIncorrect + * @param mapFeedbackCorrect + * @param mcContent + */ protected void persistQuestions(HttpServletRequest request, Map mapQuestionsContent, Map mapFeedbackIncorrect, Map mapFeedbackCorrect, McContent mcContent) { IMcService mcService =McUtils.getToolService(request); @@ -1803,7 +1662,7 @@ Map mapGeneralSelectedOptionsContent=(Map)request.getSession().getAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT); logger.debug("final MAP_GENERAL_SELECTED_OPTIONS_CONTENT :" + mapGeneralSelectedOptionsContent); - Map mapWeights= repopulateMap(request, "questionWeight"); + Map mapWeights= AuthoringUtil.repopulateMap(request, "questionWeight"); request.getSession().setAttribute(MAP_WEIGHTS, mapWeights); System.out.print("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS)); @@ -1856,7 +1715,16 @@ } - + /** + * prepares the data to persist options in the db + * persistOptions(HttpServletRequest request, Map mapGeneralOptionsContent, Map mapGeneralSelectedOptionsContent, McQueContent mcQueContent, String questionIndex) + * + * @param request + * @param mapGeneralOptionsContent + * @param mapGeneralSelectedOptionsContent + * @param mcQueContent + * @param questionIndex + */ protected void persistOptions(HttpServletRequest request, Map mapGeneralOptionsContent, Map mapGeneralSelectedOptionsContent, McQueContent mcQueContent, String questionIndex) { IMcService mcService =McUtils.getToolService(request); @@ -1890,6 +1758,15 @@ } + /** + * creates the options for a particular question in the db + * persistOptionsFinal(HttpServletRequest request, Map currentOptions, Map selectedOptions, McQueContent mcQueContent) + * + * @param request + * @param currentOptions + * @param selectedOptions + * @param mcQueContent + */ protected void persistOptionsFinal(HttpServletRequest request, Map currentOptions, Map selectedOptions, McQueContent mcQueContent) { IMcService mcService =McUtils.getToolService(request); @@ -1930,6 +1807,14 @@ } } + /** + * creates the questions content in the db. + * createContent(HttpServletRequest request, McAuthoringForm mcAuthoringForm) + * + * @param request + * @param mcAuthoringForm + * @return + */ protected McContent createContent(HttpServletRequest request, McAuthoringForm mcAuthoringForm) { IMcService mcService =McUtils.getToolService(request); @@ -2078,6 +1963,15 @@ } + /** + * includes the new question entry in the questions Map + * addQuestionMemory(HttpServletRequest request, McAuthoringForm mcAuthoringForm, Map mapQuestionsContent, boolean increaseMapSize) + * + * @param request + * @param mcAuthoringForm + * @param mapQuestionsContent + * @param increaseMapSize + */ protected void addQuestionMemory(HttpServletRequest request, McAuthoringForm mcAuthoringForm, Map mapQuestionsContent, boolean increaseMapSize) { if (increaseMapSize) @@ -2099,51 +1993,17 @@ } - protected boolean validateOptions(HttpServletRequest request) - { - logger.debug("will validateOptions"); - String parameterType="checkBoxSelected"; - for (int i=1; i <= MAX_OPTION_COUNT ; i++) - { - String isCorrect=request.getParameter(parameterType + i); - logger.debug("isCorrect: " + isCorrect); - - if (isCorrect != null) - { - if (isCorrect.equals("Correct")) - return true; - } - } - return false; - } - - - protected boolean validateSubTotalWeights(HttpServletRequest request, McAuthoringForm mcAuthoringForm) - { - Map mapWeights= repopulateCurrentWeightsMap(request, "questionWeight"); - logger.debug("mapWeights: " + mapWeights); - - int totalWeight=0; - Iterator itMap = mapWeights.entrySet().iterator(); - while (itMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - - int currentWeight=new Integer(pairs.getValue().toString()).intValue(); - totalWeight= totalWeight + currentWeight; - logger.debug("sub totalWeight: " + totalWeight); - } - logger.debug("final totalWeight: " + totalWeight); - - if (totalWeight > 100) - return false; - else - return true; - } - + /** + * ensures that the weight valued entered are valid + * validateQuestionWeights(HttpServletRequest request, McAuthoringForm mcAuthoringForm) + * + * @param request + * @param mcAuthoringForm + * @return + */ protected boolean validateQuestionWeights(HttpServletRequest request, McAuthoringForm mcAuthoringForm) { - Map mapWeights= repopulateCurrentWeightsMap(request, "questionWeight"); + Map mapWeights= AuthoringUtil.repopulateCurrentWeightsMap(request, "questionWeight"); logger.debug("mapWeights: " + mapWeights); Iterator itMap = mapWeights.entrySet().iterator(); @@ -2195,228 +2055,8 @@ return true; } - protected boolean validateTotalWeight(HttpServletRequest request) - { - Map mapWeights= repopulateCurrentWeightsMap(request, "questionWeight"); - logger.debug("mapWeights: " + mapWeights); - - Iterator itMap = mapWeights.entrySet().iterator(); - int totalWeight=0; - while (itMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - - if ((pairs.getValue() != null) || (pairs.getValue().toString().length() > 0)) - { - totalWeight=totalWeight+ new Integer(pairs.getValue().toString()).intValue(); - } - } - - logger.debug("totalWeight: " + totalWeight); - - if (totalWeight != 100) - { - return false; - } - - return true; - } - - protected Map shiftMap(Map mapQuestionsContent, String questionIndex , String movableQuestionEntry, String direction) - { - logger.debug("movableQuestionEntry: " + movableQuestionEntry); - /* map to be returned */ - Map mapTempQuestionsContent= new TreeMap(new McComparator()); - - Iterator itMap = mapQuestionsContent.entrySet().iterator(); - String shiftableEntry=null; - - int shiftableIndex=0; - if (direction.equals("down")) - { - logger.debug("moving map down"); - shiftableIndex=new Integer(questionIndex).intValue() + 1; - } - else - { - logger.debug("moving map up"); - shiftableIndex=new Integer(questionIndex).intValue() - 1; - - } - - logger.debug("shiftableIndex: " + shiftableIndex); - shiftableEntry=(String)mapQuestionsContent.get(new Integer(shiftableIndex).toString()); - logger.debug("shiftable entry: " + shiftableEntry); - - if (shiftableEntry != null) - { - Iterator itQuestionsMap = mapQuestionsContent.entrySet().iterator(); - long mapCounter=0; - while (itQuestionsMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itQuestionsMap.next(); - logger.debug("comparing the pair: " + pairs.getKey() + " = " + pairs.getValue()); - mapCounter++; - logger.debug("mapCounter: " + mapCounter); - - if (!pairs.getKey().equals(questionIndex) && !pairs.getKey().equals(new Integer(shiftableIndex).toString())) - { - logger.debug("normal copy " + questionIndex); - mapTempQuestionsContent.put(new Long(mapCounter).toString(), pairs.getValue()); - } - else if (pairs.getKey().equals(questionIndex)) - { - logger.debug("move type 1 " + questionIndex); - mapTempQuestionsContent.put(new Long(mapCounter).toString(), shiftableEntry); - } - else if (pairs.getKey().equals(new Integer(shiftableIndex).toString())) - { - logger.debug("move type 2 " + shiftableIndex); - mapTempQuestionsContent.put(new Long(mapCounter).toString(), movableQuestionEntry); - } - } - } - else - { - logger.debug("no change to map"); - mapTempQuestionsContent=mapQuestionsContent; - } - return mapTempQuestionsContent; - - } - - - /** - * shrinks the size of the Map to only used entries - * - * @param mapQuestionContent - * @param request - * @return - */ - protected Map repopulateMap(HttpServletRequest request, String parameterType) - { - Map mapTempQuestionsContent= new TreeMap(new McComparator()); - logger.debug("parameterType: " + parameterType); - - long mapCounter=0; - for (long i=1; i <= MAX_QUESTION_COUNT ; i++) - { - String candidateEntry =request.getParameter(parameterType + i); - if ( - (candidateEntry != null) && - (candidateEntry.length() > 0) - ) - { - mapCounter++; - mapTempQuestionsContent.put(new Long(mapCounter).toString(), candidateEntry); - } - } - logger.debug("return repopulated Map: " + mapTempQuestionsContent); - return mapTempQuestionsContent; - } - - - protected Map repopulateCurrentWeightsMap(HttpServletRequest request, String parameterType) - { - Map mapTempQuestionsContent= new TreeMap(new McComparator()); - logger.debug("parameterType: " + parameterType); - - long mapCounter=0; - for (long i=1; i <= MAX_QUESTION_COUNT ; i++) - { - String candidateEntry =request.getParameter(parameterType + i); - String questionText =request.getParameter("questionContent" + i); - if ((questionText != null) && (questionText.length() > 0)) - { - logger.debug("questionText: " + questionText); - if (candidateEntry != null) - { - mapCounter++; - mapTempQuestionsContent.put(new Long(mapCounter).toString(), candidateEntry); - } - } - - } - logger.debug("return repopulated Map: " + mapTempQuestionsContent); - return mapTempQuestionsContent; - } - - - protected boolean verifyDuplicatesOptionsMap(Map mapOptionsContent) - { - Map originalMapOptionsContent=mapOptionsContent; - Map backupMapOptionsContent=mapOptionsContent; - - int optionCount=0; - for (long i=1; i <= MAX_OPTION_COUNT ; i++) - { - String currentOption=(String)originalMapOptionsContent.get(new Long(i).toString()); - logger.debug("verified currentOption " + currentOption); - - optionCount=0; - for (long j=1; j <= MAX_OPTION_COUNT ; j++) - { - String backedOption=(String)backupMapOptionsContent.get(new Long(j).toString()); - - if ((currentOption != null) && (backedOption !=null)) - { - if (currentOption.equals(backedOption)) - { - optionCount++; - logger.debug("optionCount for " + currentOption + " is: " + optionCount); - } - - if (optionCount > 1) - return false; - } - } - } - return true; - } - - - protected boolean validateQuestionsNotEmpty(Map mapQuestionsContent) - { - Iterator itMap = mapQuestionsContent.entrySet().iterator(); - while (itMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); - if ((pairs.getValue() != null) && (pairs.getValue().toString().length() == 0)) - return false; - - } - return true; - } - - - protected Map repopulateCurrentCheckBoxStatesMap(HttpServletRequest request) - { - Map mapTempContent= new TreeMap(new McComparator()); - - long mapCounter=0; - for (long i=1; i <= MAX_OPTION_COUNT ; i++) - { - String candidateEntry =request.getParameter("checkBoxSelected" + i); - String optionText =request.getParameter("optionContent" + i); - - if ( - (candidateEntry != null) && - (candidateEntry.length() > 0) - ) - { - if (candidateEntry.equals("Correct")) - { - mapCounter++; - mapTempContent.put(new Long(mapCounter).toString(), optionText); - } - } - } - logger.debug("return repopulated currentCheckBoxStatesMap: " + mapTempContent); - return mapTempContent; - } - - /** * persists error messages to request scope * @param request Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java =================================================================== diff -u -rfd6328a28e3ebbd9700e73f6120398153b2dacb1 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java (.../McStarterAction.java) (revision fd6328a28e3ebbd9700e73f6120398153b2dacb1) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java (.../McStarterAction.java) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -1,72 +1,34 @@ /** - * @author ozgurd + * @author Ozgur Demirtas * - * Created on 12/10/2005 - * - * initializes the tool's authoring mode - */ - -/** - * Tool path The URL path for the tool should be /tool/$TOOL_SIG. - * - * CONTENT_LOCKED refers to content being in use or not: Any students answered that content? - * For future CONTENT_LOCKED ->CONTENT_IN_USE - * - * McStarterAction loads the default content and initializes the presentation Map + * McStarterAction loads the default content and initializes the presentation Map. + * Initializes the tool's authoring mode * Requests can come either from authoring envuironment or from the monitoring environment for Edit Activity screen * - * Check McUtils.createAuthoringUser again User Management Service is ready + * Tool path The URL path for the tool should be /tool/$TOOL_SIG. * - * */ + + + + -/** - * - * Tool Content: - * - * While tool's manage their own content, the LAMS core and the tools work together to create and use the content. - * The tool content id (toolContentId) is the key by which the tool and the LAMS core discuss data - - * it is generated by the LAMS core and supplied to the tool whenever content needs to be stored. - * The LAMS core will refer to the tool content id whenever the content needs to be used. - * Tool content will be covered in more detail in following sections. - * - * Each tool will have one piece of content that is the default content. - * The tool content id for this content is created as part of the installation process. - * Whenever a tool is asked for some tool content that does not exist, it should supply the default tool content. - * This will allow the system to render the normal screen, albeit with useless information, rather than crashing. + + */ -/** -* -* Authoring URL: -* -* The tool must supply an authoring module, which will be called to create new content or edit existing content. It will be called by an authoring URL using the following format: ????? -* The initial data displayed on the authoring screen for a new tool content id may be the default tool content. -* -* Authoring UI data consists of general Activity data fields and the Tool specific data fields. -* The authoring interface will have three tabs. The mandatory (and suggested) fields are given. Each tool will have its own fields which it will add on any of the three tabs, as appropriate to the tabs' function. -* -* Basic: Displays the basic set of fields that are needed for the tool, and it could be expected that a new LAMS user would use. Mandatory fields: Title, Instructions. -* Advanced: Displays the extra fields that would be used by experienced LAMS users. Optional fields: Lock On Finish, Make Responses Anonymous -* Instructions: Displays the "instructions" fields for teachers. Mandatory fields: Online instructions, Offline instructions, Document upload. -* The "Define Later" and "Run Offline" options are set on the Flash authoring part, and not on the tool's authoring screens. -* -* Preview The tool must be able to show the specified content as if it was running in a lesson. It will be the learner url with tool access mode set to ToolAccessMode.AUTHOR. -* Export The tool must be able to export its tool content for part of the overall learning design export. -* -* The format of the serialization for export is XML. Tool will define extra namespace inside the element to add a new data element (type). Inside the data element, it can further define more structures and types as it seems fit. -* The data elements must be "version" aware. The data elements must be "type" aware if they are to be shared between Tools. -* -* LAMS Xpress (Ernie, could you put something in here. You explain it better than I do!) -* Data Exchange At present, there is no data exchange format between tools. Therefore if a tool needs to work with another tool, they will need to be combined in a new tool. We plan to have a data exchange method in a future version of LAMS. -* -*/ - -/** use from org.lamsfoundation.lams.web.util.AttributeNames */ - -/* - * check back McUtils.configureContentRepository(request); - */ - package org.lamsfoundation.lams.tool.mc.web; import java.io.IOException; import java.util.Iterator; @@ -97,8 +59,14 @@ import org.lamsfoundation.lams.tool.mc.service.IMcService; import org.lamsfoundation.lams.tool.mc.service.McServiceProxy; - public class McStarterAction extends Action implements McAppConstants { + /* + * CONTENT_LOCKED refers to content being in use or not: Any students answered that content? + * For future CONTENT_LOCKED ->CONTENT_IN_USE + * + * may use org.lamsfoundation.lams.web.util.AttributeNames + * check back McUtils.configureContentRepository(request); + */ static Logger logger = Logger.getLogger(McStarterAction.class.getName()); public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/McContent.hbm.xml =================================================================== diff -u -rc1e9ee48a9fd7b643af1e4eae6b9806b9aae18d1 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/McContent.hbm.xml (.../McContent.hbm.xml) (revision c1e9ee48a9fd7b643af1e4eae6b9806b9aae18d1) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/McContent.hbm.xml (.../McContent.hbm.xml) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -44,17 +44,17 @@ @@ -77,10 +77,10 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/web/BasicContent.jsp =================================================================== diff -u -r48ae5d808d7eb36ec52e696a646b035cfa70e60b -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/web/BasicContent.jsp (.../BasicContent.jsp) (revision 48ae5d808d7eb36ec52e696a646b035cfa70e60b) +++ lams_tool_lamc/web/BasicContent.jsp (.../BasicContent.jsp) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -53,7 +53,7 @@ - Index: lams_tool_lamc/web/OptionsContent.jsp =================================================================== diff -u -r48ae5d808d7eb36ec52e696a646b035cfa70e60b -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/web/OptionsContent.jsp (.../OptionsContent.jsp) (revision 48ae5d808d7eb36ec52e696a646b035cfa70e60b) +++ lams_tool_lamc/web/OptionsContent.jsp (.../OptionsContent.jsp) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -47,7 +47,7 @@
+
- Index: lams_tool_lamc/web/WEB-INF/struts-config.xml =================================================================== diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r25a3cd766f44f20c25042ad630f87b5b79a53671 --- lams_tool_lamc/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) +++ lams_tool_lamc/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 25a3cd766f44f20c25042ad630f87b5b79a53671) @@ -62,7 +62,6 @@ path=".errorList" redirect="true" /> - -
+