Index: lams_central/src/java/org/lamsfoundation/lams/util/CentralConstants.java =================================================================== diff -u -r9a772f5ba1954a3a719a19e7ae237b6b09dc76ef -r8f7975d272f91acc26c785848d82d26d6b5dd357 --- lams_central/src/java/org/lamsfoundation/lams/util/CentralConstants.java (.../CentralConstants.java) (revision 9a772f5ba1954a3a719a19e7ae237b6b09dc76ef) +++ lams_central/src/java/org/lamsfoundation/lams/util/CentralConstants.java (.../CentralConstants.java) (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -147,6 +147,8 @@ public static final int PLANNER_MAX_OPTIONS = 4; + public static final int PLANNER_MAX_PARALLEL_ACTIVITIES = 4; + public static final String MONITORING_SERVICE_BEAN_NAME = "monitoringService"; public static final String CENTRAL_MESSAGE_SERVICE_BEAN_NAME = "centralMessageService"; Index: lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java =================================================================== diff -u -re66bdae723516ab13d4a6f81e5f598018f6dbe58 -r8f7975d272f91acc26c785848d82d26d6b5dd357 --- lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java (.../IndexAction.java) (revision e66bdae723516ab13d4a6f81e5f598018f6dbe58) +++ lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java (.../IndexAction.java) (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -22,6 +22,7 @@ */ package org.lamsfoundation.lams.web; +import java.io.File; import java.util.ArrayList; import java.util.List; @@ -74,6 +75,9 @@ */ public class IndexAction extends Action { + private static final String PATH_PEDAGOGICAL_PLANNER = "pedagogical_planner"; + private static final String PATH_LAMS_CENTRAL = "lams-central.war"; + private static Logger log = Logger.getLogger(IndexAction.class); private static IUserManagementService userManagementService; private static IExportToolContentService exportService; @@ -142,7 +146,9 @@ private void setHeaderLinks(HttpServletRequest request) { List headerLinks = new ArrayList(); if (request.isUserInRole(Role.AUTHOR) || request.isUserInRole(Role.AUTHOR_ADMIN)) { - headerLinks.add(new IndexLinkBean("index.planner", "javascript:openPedagogicalPlanner()")); + if (isPedagogicalPlannerAvailable()) { + headerLinks.add(new IndexLinkBean("index.planner", "javascript:openPedagogicalPlanner()")); + } headerLinks.add(new IndexLinkBean("index.author", "javascript:openAuthor()")); } headerLinks.add(new IndexLinkBean("index.myprofile", "index.do?tab=profile")); @@ -186,4 +192,12 @@ } return IndexAction.userManagementService; } + + private boolean isPedagogicalPlannerAvailable() { + String lamsEarPath = Configuration.get(ConfigurationKeys.LAMS_EAR_DIR); + String plannerPath = lamsEarPath + File.separator + IndexAction.PATH_LAMS_CENTRAL + File.separator + + IndexAction.PATH_PEDAGOGICAL_PLANNER; + File plannerDir = new File(plannerPath); + return plannerDir.isDirectory() && plannerDir.list().length > 0; + } } \ No newline at end of file Index: lams_central/src/java/org/lamsfoundation/lams/web/planner/PedagogicalPlannerAction.java =================================================================== diff -u -r9a772f5ba1954a3a719a19e7ae237b6b09dc76ef -r8f7975d272f91acc26c785848d82d26d6b5dd357 --- lams_central/src/java/org/lamsfoundation/lams/web/planner/PedagogicalPlannerAction.java (.../PedagogicalPlannerAction.java) (revision 9a772f5ba1954a3a719a19e7ae237b6b09dc76ef) +++ lams_central/src/java/org/lamsfoundation/lams/web/planner/PedagogicalPlannerAction.java (.../PedagogicalPlannerAction.java) (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -63,6 +63,7 @@ import org.lamsfoundation.lams.learningdesign.LearnerChoiceGrouping; import org.lamsfoundation.lams.learningdesign.LearningDesign; import org.lamsfoundation.lams.learningdesign.OptionsActivity; +import org.lamsfoundation.lams.learningdesign.ParallelActivity; import org.lamsfoundation.lams.learningdesign.RandomGrouping; import org.lamsfoundation.lams.learningdesign.SequenceActivity; import org.lamsfoundation.lams.learningdesign.ToolActivity; @@ -158,8 +159,11 @@ + CentralConstants.PLANNER_MAX_OPTIONS + " in Pedagogical Planner."; private static final String ERROR_NESTED_OPTIONS = "Nested optional activities are not allowed in Pedagogical Planner."; private static final String ERROR_NESTED_BRANCHING = "Nested branching activities are not allowed in Pedagogical Planner."; + private static final String ERROR_NESTED_PARALLEL = "Nested parallel activities are not allowed in Pedagogical Planner."; private static final String ERROR_TOO_MANY_BRANCHES = "Number of branches in branching activity is limited to " + CentralConstants.PLANNER_MAX_BRANCHES + " in Pedagogical Planner."; + private static final String ERROR_TOO_MANY_PARALLEL_ACTIVITIES = "Number of parallel activities is limited to " + + CentralConstants.PLANNER_MAX_PARALLEL_ACTIVITIES + " in Pedagogical Planner."; private static Logger log = Logger.getLogger(PedagogicalPlannerAction.class); @@ -260,8 +264,8 @@ // Some additional options for submitting activity forms; should be moved to configuration file in the future planner.setSendInPortions(false); - planner.setSubmitDelay(5000L); - planner.setActivitiesInPortion(2); + planner.setSubmitDelay(5000); + planner.setActivitiesPerPortion(2); request.setAttribute(CentralConstants.ATTR_PLANNER, planner); return mapping.findForward(PedagogicalPlannerAction.FORWARD_TEMPLATE); @@ -423,6 +427,27 @@ option++; } addedDTO.setLastNestedActivity(true); + } else if (activity.isParallelActivity()) { + if (isNested) { + throw new ServletException(PedagogicalPlannerAction.ERROR_NESTED_PARALLEL); + } + ParallelActivity parallelActivity = (ParallelActivity) activity; + Set nestedActivities = parallelActivity.getActivities(); + short option = 1; + for (Activity nestedActivity : nestedActivities) { + // Currently Planner supports only parallel activities, but there is no logical reason for that; + // just add colours in CSS and change this value for additional options + if (option > CentralConstants.PLANNER_MAX_PARALLEL_ACTIVITIES) { + throw new ServletException(PedagogicalPlannerAction.ERROR_TOO_MANY_PARALLEL_ACTIVITIES); + } + + addedDTO = addActivityToPlanner(learningDesign, activities, nestedActivity); + addedDTO.setParentActivityTitle(activity.getTitle()); + addedDTO.setGroup(option); + addedDTO.setComplexActivityType(PedagogicalPlannerActivityDTO.TYPE_PARALLEL_ACTIVITY); + option++; + } + addedDTO.setLastNestedActivity(true); } else { // If unknown/unsupported activity addedDTO = new PedagogicalPlannerActivityDTO(null, activity.getTitle(), false, Index: lams_central/web/css/pedagogicalPlanner.css =================================================================== diff -u -r5a30100855d83534e76db8dec0d0b603a1a1ded8 -r8f7975d272f91acc26c785848d82d26d6b5dd357 --- lams_central/web/css/pedagogicalPlanner.css (.../pedagogicalPlanner.css) (revision 5a30100855d83534e76db8dec0d0b603a1a1ded8) +++ lams_central/web/css/pedagogicalPlanner.css (.../pedagogicalPlanner.css) (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -48,7 +48,7 @@ } div#buttonArea{ - padding: 0px 10px 40px 0px; + padding: 10px 10px 40px 0px; } div#pedagogicalPlannerBusy{ margin: 0px 0px 20px 40%; @@ -73,9 +73,15 @@ td.optionFirstActivity { border-bottom: thick lightgreen solid; text-align: center; - color:lightgreen; + color: lightgreen; } +td.parallelFirstActivity { + border-bottom: thick orange solid; + text-align: center; + color: orange; +} + td.branchLastActivity { border-bottom: thick blue solid; } @@ -84,6 +90,10 @@ border-bottom: thick lightgreen solid; } +td.parallelLastActivity { + border-bottom: thick orange solid; +} + td.branch { border-left: thick blue solid; } @@ -92,6 +102,10 @@ border-left: thick lightgreen solid; } +td.parallel { + border-left: thick orange solid; +} + td.group1{ border-right: thick yellow solid; } @@ -129,8 +143,8 @@ } .sequenceActionImage { - height: 15px; - width: 15px; + height: 16px; + width: 16px; cursor: pointer; float: left; margin-left: 5px; Index: lams_central/web/images/icons/.cvsignore =================================================================== diff -u --- lams_central/web/images/icons/.cvsignore (revision 0) +++ lams_central/web/images/icons/.cvsignore (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -0,0 +1 @@ +Thumbs.db Index: lams_central/web/includes/javascript/pedagogicalPlanner.js =================================================================== diff -u -r9a772f5ba1954a3a719a19e7ae237b6b09dc76ef -r8f7975d272f91acc26c785848d82d26d6b5dd357 --- lams_central/web/includes/javascript/pedagogicalPlanner.js (.../pedagogicalPlanner.js) (revision 9a772f5ba1954a3a719a19e7ae237b6b09dc76ef) +++ lams_central/web/includes/javascript/pedagogicalPlanner.js (.../pedagogicalPlanner.js) (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -46,7 +46,7 @@ for (var activityIndex = 1;activityIndex<=activityCount;activityIndex++){ //we calculate delay before the form should be submitted - var effectiveDelay = sendInPortions ? Math.floor((activityIndex - 1) / activitiesInPortion) * submitDelay : 0; + var effectiveDelay = sendInPortions ? Math.floor((activityIndex - 1) / activitiesPerPortion) * submitDelay : 0; //each tool will implement an interface that will provide a simplified authoring page with form named "pedagogicalPlannerForm" $('#activity'+activityIndex).contents().find('#callID').val(callAttemptedID); $('#activity'+activityIndex).contents().find('#activityOrderNumber').val(activityIndex); @@ -178,11 +178,10 @@ if (document.getElementById("hasSubnodesType").checked){ document.getElementById("fileArea").style.display="none"; document.getElementById("fullDescriptionArea").style.display="block"; + } else { document.getElementById("fullDescriptionArea").style.display="none"; document.getElementById("fileArea").style.display="block"; } - - } \ No newline at end of file Index: lams_central/web/pedagogical_planner/sequenceChooser.jsp =================================================================== diff -u -r9a772f5ba1954a3a719a19e7ae237b6b09dc76ef -r8f7975d272f91acc26c785848d82d26d6b5dd357 --- lams_central/web/pedagogical_planner/sequenceChooser.jsp (.../sequenceChooser.jsp) (revision 9a772f5ba1954a3a719a19e7ae237b6b09dc76ef) +++ lams_central/web/pedagogical_planner/sequenceChooser.jsp (.../sequenceChooser.jsp) (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -87,7 +87,8 @@ <%-- Iterate through subnodes --%> - + <%-- Width is in percent, otherwise IE does not display it as desired --%> + <%-- Cell with icons (info or actions like remove node) --%> @@ -179,7 +180,7 @@ - + " class="button" /> @@ -219,8 +220,8 @@


-
- +
+ <%-- DIVs below are displayed/hidden depending of the subnode type: containing subnodes or opening a template --%> @@ -255,7 +256,7 @@ ${node.fileName}

- +
Index: lams_central/web/pedagogical_planner/templateBase.jsp =================================================================== diff -u -rc697b5c30ab742ab453859355b35cd518856334f -r8f7975d272f91acc26c785848d82d26d6b5dd357 --- lams_central/web/pedagogical_planner/templateBase.jsp (.../templateBase.jsp) (revision c697b5c30ab742ab453859355b35cd518856334f) +++ lams_central/web/pedagogical_planner/templateBase.jsp (.../templateBase.jsp) (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -15,7 +15,7 @@ var activityCount = ${fn:length(planner.activities)}; //How many activities are there in the sequence var activitySupportingPlannerCount = ${planner.activitySupportingPlannerCount}; //How many of activities support the planner (their data will be submitted) var sendInPortions = ${planner.sendInPortions}; //Should the forms be send all at once or rather in parts - var activitiesInPortion = ${planner.activitiesInPortion}; //After how many submitted forms the script should pause + var activitiesPerPortion = ${planner.activitiesPerPortion}; //After how many submitted forms the script should pause var submitDelay = ${planner.submitDelay}; //How many miliseconds should the script wait before sending another portion of forms var saveDetailsUrl = ""; var errorPlannerNotSaved = ''; @@ -114,6 +114,9 @@ + + + <%-- Small row with a down arrow --%> @@ -155,7 +158,7 @@ - ${complexActivityType} group${activity.group} + ${complexActivityType} group${activity.group} ${complexActivityType}LastActivity Index: lams_common/src/java/org/lamsfoundation/lams/planner/dto/PedagogicalPlannerActivityDTO.java =================================================================== diff -u -r00a6e145b37916eb1561ea5c68319b0fc691681b -r8f7975d272f91acc26c785848d82d26d6b5dd357 --- lams_common/src/java/org/lamsfoundation/lams/planner/dto/PedagogicalPlannerActivityDTO.java (.../PedagogicalPlannerActivityDTO.java) (revision 00a6e145b37916eb1561ea5c68319b0fc691681b) +++ lams_common/src/java/org/lamsfoundation/lams/planner/dto/PedagogicalPlannerActivityDTO.java (.../PedagogicalPlannerActivityDTO.java) (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -39,6 +39,7 @@ public static final short TYPE_BRANCHING_ACTIVITY = 1; public static final short TYPE_OPTIONAL_ACTIVITY = 2; + public static final short TYPE_PARALLEL_ACTIVITY = 3; public Boolean getSupportsPlanner() { return supportsPlanner; @@ -113,7 +114,7 @@ } public void setGroup(Short branch) { - this.group = branch; + group = branch; } public String getParentActivityTitle() { Index: lams_common/src/java/org/lamsfoundation/lams/planner/dto/PedagogicalPlannerTemplateDTO.java =================================================================== diff -u -r00a6e145b37916eb1561ea5c68319b0fc691681b -r8f7975d272f91acc26c785848d82d26d6b5dd357 --- lams_common/src/java/org/lamsfoundation/lams/planner/dto/PedagogicalPlannerTemplateDTO.java (.../PedagogicalPlannerTemplateDTO.java) (revision 00a6e145b37916eb1561ea5c68319b0fc691681b) +++ lams_common/src/java/org/lamsfoundation/lams/planner/dto/PedagogicalPlannerTemplateDTO.java (.../PedagogicalPlannerTemplateDTO.java) (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -28,8 +28,8 @@ public class PedagogicalPlannerTemplateDTO { private String sequenceTitle; private Boolean sendInPortions; - private Integer activitiesInPortion; - private Long submitDelay; + private Integer activitiesPerPortion; + private Integer submitDelay; private List activities; private Long learningDesignID; private Integer activitySupportingPlannerCount = 0; @@ -50,19 +50,19 @@ this.sendInPortions = sendInPortions; } - public Integer getActivitiesInPortion() { - return activitiesInPortion; + public Integer getActivitiesPerPortion() { + return activitiesPerPortion; } - public void setActivitiesInPortion(Integer activitiesInPortion) { - this.activitiesInPortion = activitiesInPortion; + public void setActivitiesPerPortion(Integer activitiesInPortion) { + activitiesPerPortion = activitiesInPortion; } - public Long getSubmitDelay() { + public Integer getSubmitDelay() { return submitDelay; } - public void setSubmitDelay(Long submitDelay) { + public void setSubmitDelay(Integer submitDelay) { this.submitDelay = submitDelay; } Index: lams_tool_scribe/build.properties =================================================================== diff -u -rf7c130109254ea187c148bdd7270455130c2f8a1 -r8f7975d272f91acc26c785848d82d26d6b5dd357 --- lams_tool_scribe/build.properties (.../build.properties) (revision f7c130109254ea187c148bdd7270455130c2f8a1) +++ lams_tool_scribe/build.properties (.../build.properties) (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -3,7 +3,7 @@ signature=lascrb11 # project version -tool.version=20080229 +tool.version=20090226 # hide tool option hideTool=true Index: lams_tool_scribe/db/sql/tool_insert.sql =================================================================== diff -u -r691d0f5085a52d31d37cb556b134714e944d5c27 -r8f7975d272f91acc26c785848d82d26d6b5dd357 --- lams_tool_scribe/db/sql/tool_insert.sql (.../tool_insert.sql) (revision 691d0f5085a52d31d37cb556b134714e944d5c27) +++ lams_tool_scribe/db/sql/tool_insert.sql (.../tool_insert.sql) (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -23,6 +23,7 @@ export_pfolio_class_url, contribute_url, moderation_url, +pedagogical_planner_url, help_url, language_file, classpath_addition, @@ -53,6 +54,7 @@ 'tool/lascrb11/exportPortfolio?mode=teacher', 'tool/lascrb11/contribute.do', 'tool/lascrb11/moderate.do', +'tool/lascrb11/pedagogicalPlanner.do', 'http://wiki.lamsfoundation.org/display/lamsdocs/lascrb11', 'org.lamsfoundation.lams.tool.scribe.ApplicationResources', 'lams-tool-lascrb11.jar', Index: lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/dbupdates/patch20090226_updateFrom22.sql =================================================================== diff -u --- lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/dbupdates/patch20090226_updateFrom22.sql (revision 0) +++ lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/dbupdates/patch20090226_updateFrom22.sql (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -0,0 +1,14 @@ +-- SQL statements to update from LAMS 2.2 + +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; + +----------------------Put all sql statements below here------------------------- + +UPDATE lams_tool SET pedagogical_planner_url='tool/lascrb11/pedagogicalPlanner.do' WHERE tool_signature='lascrb11'; + +----------------------Put all sql statements above here------------------------- + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; \ No newline at end of file Index: lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/service/IScribeService.java =================================================================== diff -u -r17be8146c14155314d21784f5a24b6e10ee4818a -r8f7975d272f91acc26c785848d82d26d6b5dd357 --- lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/service/IScribeService.java (.../IScribeService.java) (revision 17be8146c14155314d21784f5a24b6e10ee4818a) +++ lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/service/IScribeService.java (.../IScribeService.java) (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -37,129 +37,127 @@ * Defines the services available to the web layer from the Scribe Service */ public interface IScribeService { - /** - * Makes a copy of the default content and assigns it a newContentID - * - * @params newContentID - * @return - */ - public Scribe copyDefaultContent(Long newContentID); + /** + * Makes a copy of the default content and assigns it a newContentID + * + * @params newContentID + * @return + */ + public Scribe copyDefaultContent(Long newContentID); - /** - * Returns an instance of the Scribe tools default content. - * - * @return - */ - public Scribe getDefaultContent(); + /** + * Returns an instance of the Scribe tools default content. + * + * @return + */ + public Scribe getDefaultContent(); - /** - * @param toolSignature - * @return - */ - public Long getDefaultContentIdBySignature(String toolSignature); + /** + * @param toolSignature + * @return + */ + public Long getDefaultContentIdBySignature(String toolSignature); - /** - * @param toolContentID - * @return - */ - public Scribe getScribeByContentId(Long toolContentID); + /** + * @param toolContentID + * @return + */ + public Scribe getScribeByContentId(Long toolContentID); - /** - * @param toolContentId - * @param file - * @param type - * @return - */ - public ScribeAttachment uploadFileToContent(Long toolContentId, - FormFile file, String type); + /** + * @param toolContentId + * @param file + * @param type + * @return + */ + public ScribeAttachment uploadFileToContent(Long toolContentId, FormFile file, String type); - /** - * @param uuid - * @param versionID - */ - public void deleteFromRepository(Long uuid, Long versionID) - throws ScribeException; + /** + * @param uuid + * @param versionID + */ + public void deleteFromRepository(Long uuid, Long versionID) throws ScribeException; - /** - * @param contentID - * @param uuid - * @param versionID - * @param type - */ - public void deleteInstructionFile(Long contentID, Long uuid, - Long versionID, String type); + /** + * @param contentID + * @param uuid + * @param versionID + * @param type + */ + public void deleteInstructionFile(Long contentID, Long uuid, Long versionID, String type); - /** - * @param scribe - */ - public void saveOrUpdateScribe(Scribe scribe); + /** + * @param scribe + */ + public void saveOrUpdateScribe(Scribe scribe); - /** - * @param toolSessionId - * @return - */ - public ScribeSession getSessionBySessionId(Long toolSessionId); + /** + * @param toolSessionId + * @return + */ + public ScribeSession getSessionBySessionId(Long toolSessionId); - /** - * @param scribeSession - */ - public void saveOrUpdateScribeSession(ScribeSession scribeSession); + /** + * @param scribeSession + */ + public void saveOrUpdateScribeSession(ScribeSession scribeSession); - /** - * - * @param userId - * @param toolSessionId - * @return - */ - public ScribeUser getUserByUserIdAndSessionId(Long userId, Long toolSessionId); + /** + * + * @param userId + * @param toolSessionId + * @return + */ + public ScribeUser getUserByUserIdAndSessionId(Long userId, Long toolSessionId); - /** - * - * @param loginName - * @param sessionID - * @return - */ - public ScribeUser getUserByLoginNameAndSessionId(String loginName, - Long sessionId); + /** + * + * @param loginName + * @param sessionID + * @return + */ + public ScribeUser getUserByLoginNameAndSessionId(String loginName, Long sessionId); - /** - * - * @param uid - * @return - */ - public ScribeUser getUserByUID(Long uid); + /** + * + * @param uid + * @return + */ + public ScribeUser getUserByUID(Long uid); - /** - * - * @param scribeUser - */ - public void saveOrUpdateScribeUser(ScribeUser scribeUser); + /** + * + * @param scribeUser + */ + public void saveOrUpdateScribeUser(ScribeUser scribeUser); - /** - * - * @param user - * @param scribeSession - * @return - */ - public ScribeUser createScribeUser(UserDTO user, ScribeSession scribeSession); + /** + * + * @param user + * @param scribeSession + * @return + */ + public ScribeUser createScribeUser(UserDTO user, ScribeSession scribeSession); - public Long createNotebookEntry(Long id, Integer idType, String signature, - Integer userID, String entry); + public Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry); - public NotebookEntry getEntry(Long id, Integer idType, String signature, - Integer userID); + public NotebookEntry getEntry(Long id, Integer idType, String signature, Integer userID); - /** - * Delete heading's report by given heading UID. - * @param uid - */ - public void deleteHeadingReport(Long uid); - - /** - * Clone heading from scribe content. - * @param toolSessionId - */ - public void createReportEntry(Long toolSessionId); - - boolean isGroupedActivity(long toolContentID); + /** + * Delete heading's report by given heading UID. + * + * @param uid + */ + public void deleteHeadingReport(Long uid); + + /** + * Clone heading from scribe content. + * + * @param toolSessionId + */ + public void createReportEntry(Long toolSessionId); + + boolean isGroupedActivity(long toolContentID); + + public void deleteHeading(Long headingUid); } \ No newline at end of file Index: lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/service/ScribeService.java =================================================================== diff -u -r17be8146c14155314d21784f5a24b6e10ee4818a -r8f7975d272f91acc26c785848d82d26d6b5dd357 --- lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/service/ScribeService.java (.../ScribeService.java) (revision 17be8146c14155314d21784f5a24b6e10ee4818a) +++ lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/service/ScribeService.java (.../ScribeService.java) (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -89,638 +89,612 @@ /** * An implementation of the IScribeService interface. * - * As a requirement, all LAMS tool's service bean must implement - * ToolContentManager and ToolSessionManager. + * As a requirement, all LAMS tool's service bean must implement ToolContentManager and ToolSessionManager. */ public class ScribeService implements ToolSessionManager, ToolContentManager, ToolContentImport102Manager, - IScribeService { + IScribeService { - static Logger logger = Logger.getLogger(ScribeService.class.getName()); + static Logger logger = Logger.getLogger(ScribeService.class.getName()); - private IScribeDAO scribeDAO = null; + private IScribeDAO scribeDAO = null; - private IScribeSessionDAO scribeSessionDAO = null; - - private IScribeHeadingDAO scribeHeadingDAO = null; + private IScribeSessionDAO scribeSessionDAO = null; - private IScribeUserDAO scribeUserDAO = null; + private IScribeHeadingDAO scribeHeadingDAO = null; - private IScribeAttachmentDAO scribeAttachmentDAO = null; + private IScribeUserDAO scribeUserDAO = null; - private ILearnerService learnerService; + private IScribeAttachmentDAO scribeAttachmentDAO = null; - private ILamsToolService toolService; + private ILearnerService learnerService; - private IToolContentHandler scribeToolContentHandler = null; + private ILamsToolService toolService; - private IRepositoryService repositoryService = null; + private IToolContentHandler scribeToolContentHandler = null; - private IAuditService auditService = null; + private IRepositoryService repositoryService = null; - private IExportToolContentService exportContentService; + private IAuditService auditService = null; - private ICoreNotebookService coreNotebookService; - - public ScribeService() { - super(); - // TODO Auto-generated constructor stub - } + private IExportToolContentService exportContentService; - /* ************ Methods from ToolSessionManager ************* */ - public void createToolSession(Long toolSessionId, String toolSessionName, - Long toolContentId) throws ToolException { - if (logger.isDebugEnabled()) { - logger.debug("entering method createToolSession:" - + " toolSessionId = " + toolSessionId - + " toolSessionName = " + toolSessionName - + " toolContentId = " + toolContentId); - } + private ICoreNotebookService coreNotebookService; - ScribeSession session = new ScribeSession(); - session.setSessionId(toolSessionId); - session.setSessionName(toolSessionName); - Scribe scribe = scribeDAO.getByContentId(toolContentId); - session.setScribe(scribe); - - session.setForceComplete(false); - session.setReportSubmitted(false); - scribeSessionDAO.saveOrUpdate(session); - } + public ScribeService() { + super(); + // TODO Auto-generated constructor stub + } - public String leaveToolSession(Long toolSessionId, Long learnerId) - throws DataMissingException, ToolException { - return learnerService.completeToolSession(toolSessionId, learnerId); + /* ************ Methods from ToolSessionManager ************* */ + public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentId) throws ToolException { + if (ScribeService.logger.isDebugEnabled()) { + ScribeService.logger.debug("entering method createToolSession:" + " toolSessionId = " + toolSessionId + + " toolSessionName = " + toolSessionName + " toolContentId = " + toolContentId); } - public ToolSessionExportOutputData exportToolSession(Long toolSessionId) - throws DataMissingException, ToolException { - // TODO Auto-generated method stub - return null; - } + ScribeSession session = new ScribeSession(); + session.setSessionId(toolSessionId); + session.setSessionName(toolSessionName); + Scribe scribe = scribeDAO.getByContentId(toolContentId); + session.setScribe(scribe); - public ToolSessionExportOutputData exportToolSession(List toolSessionIds) - throws DataMissingException, ToolException { - // TODO Auto-generated method stub - return null; - } + session.setForceComplete(false); + session.setReportSubmitted(false); + scribeSessionDAO.saveOrUpdate(session); + } - public void removeToolSession(Long toolSessionId) - throws DataMissingException, ToolException { - scribeSessionDAO.deleteBySessionID(toolSessionId); - //TODO check if cascade worked - } + public String leaveToolSession(Long toolSessionId, Long learnerId) throws DataMissingException, ToolException { + return learnerService.completeToolSession(toolSessionId, learnerId); + } - /** - * Get the tool output for the given tool output names. - * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.util.List, java.lang.Long, java.lang.Long) - */ - public SortedMap getToolOutput(List names, - Long toolSessionId, Long learnerId) { - return new TreeMap(); - } + public ToolSessionExportOutputData exportToolSession(Long toolSessionId) throws DataMissingException, ToolException { + // TODO Auto-generated method stub + return null; + } - /** - * Get the tool output for the given tool output name. - * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.lang.String, java.lang.Long, java.lang.Long) - */ - public ToolOutput getToolOutput(String name, Long toolSessionId, - Long learnerId) { - return null; - } + public ToolSessionExportOutputData exportToolSession(List toolSessionIds) throws DataMissingException, + ToolException { + // TODO Auto-generated method stub + return null; + } - /* ************ Methods from ToolContentManager ************************* */ + public void removeToolSession(Long toolSessionId) throws DataMissingException, ToolException { + scribeSessionDAO.deleteBySessionID(toolSessionId); + // TODO check if cascade worked + } - public void copyToolContent(Long fromContentId, Long toContentId) - throws ToolException { + /** + * Get the tool output for the given tool output names. + * + * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.util.List, java.lang.Long, + * java.lang.Long) + */ + public SortedMap getToolOutput(List names, Long toolSessionId, Long learnerId) { + return new TreeMap(); + } - if (logger.isDebugEnabled()) { - logger.debug("entering method copyToolContent:" + " fromContentId=" - + fromContentId + " toContentId=" + toContentId); - } + /** + * Get the tool output for the given tool output name. + * + * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.lang.String, java.lang.Long, + * java.lang.Long) + */ + public ToolOutput getToolOutput(String name, Long toolSessionId, Long learnerId) { + return null; + } - if (toContentId == null) { - String error = "Failed to copy tool content: toContentID is null"; - throw new ToolException(error); - } + /* ************ Methods from ToolContentManager ************************* */ - Scribe fromContent = null; - if ( fromContentId != null ) { - fromContent = scribeDAO.getByContentId(fromContentId); - } - if (fromContent == null) { - // create the fromContent using the default tool content - fromContent = getDefaultContent(); - } - Scribe toContent = Scribe.newInstance(fromContent, toContentId, - scribeToolContentHandler); - scribeDAO.saveOrUpdate(toContent); + public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException { + + if (ScribeService.logger.isDebugEnabled()) { + ScribeService.logger.debug("entering method copyToolContent:" + " fromContentId=" + fromContentId + + " toContentId=" + toContentId); } - public void setAsDefineLater(Long toolContentId, boolean value) - throws DataMissingException, ToolException { - Scribe scribe = scribeDAO.getByContentId(toolContentId); - if(scribe == null){ - throw new ToolException("Could not find tool with toolContentID: " + toolContentId); - } - scribe.setDefineLater(value); - scribeDAO.saveOrUpdate(scribe); + if (toContentId == null) { + String error = "Failed to copy tool content: toContentID is null"; + throw new ToolException(error); } - public void setAsRunOffline(Long toolContentId, boolean value) - throws DataMissingException, ToolException { - Scribe scribe = scribeDAO.getByContentId(toolContentId); - if(scribe == null){ - throw new ToolException("Could not find tool with toolContentID: " + toolContentId); - } - scribe.setRunOffline(value); - scribeDAO.saveOrUpdate(scribe); + Scribe fromContent = null; + if (fromContentId != null) { + fromContent = scribeDAO.getByContentId(fromContentId); } + if (fromContent == null) { + // create the fromContent using the default tool content + fromContent = getDefaultContent(); + } + Scribe toContent = Scribe.newInstance(fromContent, toContentId, scribeToolContentHandler); + scribeDAO.saveOrUpdate(toContent); + } - public void removeToolContent(Long toolContentId, boolean removeSessionData) - throws SessionDataExistsException, ToolException { - // TODO Auto-generated method stub + public void setAsDefineLater(Long toolContentId, boolean value) throws DataMissingException, ToolException { + Scribe scribe = scribeDAO.getByContentId(toolContentId); + if (scribe == null) { + throw new ToolException("Could not find tool with toolContentID: " + toolContentId); } + scribe.setDefineLater(value); + scribeDAO.saveOrUpdate(scribe); + } - /** - * Export the XML fragment for the tool's content, along with any files - * needed for the content. - * - * @throws DataMissingException - * if no tool content matches the toolSessionId - * @throws ToolException - * if any other error occurs - */ + public void setAsRunOffline(Long toolContentId, boolean value) throws DataMissingException, ToolException { + Scribe scribe = scribeDAO.getByContentId(toolContentId); + if (scribe == null) { + throw new ToolException("Could not find tool with toolContentID: " + toolContentId); + } + scribe.setRunOffline(value); + scribeDAO.saveOrUpdate(scribe); + } - public void exportToolContent(Long toolContentId, String rootPath) - throws DataMissingException, ToolException { - Scribe scribe = scribeDAO.getByContentId(toolContentId); - if (scribe == null) { - scribe = getDefaultContent(); - } - if (scribe == null) - throw new DataMissingException("Unable to find default content for the scribe tool"); + public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException, + ToolException { + // TODO Auto-generated method stub + } - // set ResourceToolContentHandler as null to avoid copy file node in - // repository again. - scribe = Scribe.newInstance(scribe, toolContentId, null); - scribe.setToolContentHandler(null); - scribe.setScribeSessions(null); - // wipe out the links from ScribeAttachments, ScribeHeading back to Scribe, or it will try to - // include the hibernate object version of the Scribe within the XML - Set atts = scribe.getScribeAttachments(); - for (ScribeAttachment att : atts) { - att.setScribe(null); - } - Set headings = scribe.getScribeHeadings(); - for (ScribeHeading heading : headings) { - heading.setScribe(null); - } - try { - exportContentService - .registerFileClassForExport(ScribeAttachment.class.getName(), - "fileUuid", "fileVersionId"); - exportContentService.exportToolContent(toolContentId, - scribe, scribeToolContentHandler, rootPath); - } catch (ExportToolContentException e) { - throw new ToolException(e); - } + /** + * Export the XML fragment for the tool's content, along with any files needed for the content. + * + * @throws DataMissingException + * if no tool content matches the toolSessionId + * @throws ToolException + * if any other error occurs + */ + + public void exportToolContent(Long toolContentId, String rootPath) throws DataMissingException, ToolException { + Scribe scribe = scribeDAO.getByContentId(toolContentId); + if (scribe == null) { + scribe = getDefaultContent(); } + if (scribe == null) { + throw new DataMissingException("Unable to find default content for the scribe tool"); + } - /** - * Import the XML fragment for the tool's content, along with any files - * needed for the content. - * - * @throws ToolException - * if any other error occurs - */ - public void importToolContent(Long toolContentId, Integer newUserUid, - String toolContentPath,String fromVersion,String toVersion) throws ToolException { - try { - exportContentService.registerFileClassForImport( - ScribeAttachment.class.getName(), "fileUuid", - "fileVersionId", "fileName", "fileType", null, null); + // set ResourceToolContentHandler as null to avoid copy file node in + // repository again. + scribe = Scribe.newInstance(scribe, toolContentId, null); + scribe.setToolContentHandler(null); + scribe.setScribeSessions(null); + // wipe out the links from ScribeAttachments, ScribeHeading back to Scribe, or it will try to + // include the hibernate object version of the Scribe within the XML + Set atts = scribe.getScribeAttachments(); + for (ScribeAttachment att : atts) { + att.setScribe(null); + } + Set headings = scribe.getScribeHeadings(); + for (ScribeHeading heading : headings) { + heading.setScribe(null); + } + try { + exportContentService.registerFileClassForExport(ScribeAttachment.class.getName(), "fileUuid", + "fileVersionId"); + exportContentService.exportToolContent(toolContentId, scribe, scribeToolContentHandler, rootPath); + } catch (ExportToolContentException e) { + throw new ToolException(e); + } + } - Object toolPOJO = exportContentService.importToolContent( - toolContentPath, scribeToolContentHandler,fromVersion,toVersion); - if (!(toolPOJO instanceof Scribe)) - throw new ImportToolContentException( - "Import Scribe tool content failed. Deserialized object is " - + toolPOJO); - Scribe scribe = (Scribe) toolPOJO; + /** + * Import the XML fragment for the tool's content, along with any files needed for the content. + * + * @throws ToolException + * if any other error occurs + */ + public void importToolContent(Long toolContentId, Integer newUserUid, String toolContentPath, String fromVersion, + String toVersion) throws ToolException { + try { + exportContentService.registerFileClassForImport(ScribeAttachment.class.getName(), "fileUuid", + "fileVersionId", "fileName", "fileType", null, null); - // reset it to new toolContentId - scribe.setToolContentId(toolContentId); - scribe.setCreateBy(new Long(newUserUid.longValue())); + Object toolPOJO = exportContentService.importToolContent(toolContentPath, scribeToolContentHandler, + fromVersion, toVersion); + if (!(toolPOJO instanceof Scribe)) { + throw new ImportToolContentException("Import Scribe tool content failed. Deserialized object is " + + toolPOJO); + } + Scribe scribe = (Scribe) toolPOJO; - scribeDAO.saveOrUpdate(scribe); - } catch (ImportToolContentException e) { - throw new ToolException(e); - } - } + // reset it to new toolContentId + scribe.setToolContentId(toolContentId); + scribe.setCreateBy(new Long(newUserUid.longValue())); - /** Get the definitions for possible output for an activity, based on the toolContentId. These may be definitions that are always - * available for the tool (e.g. number of marks for Multiple Choice) or a custom definition created for a particular activity - * such as the answer to the third question contains the word Koala and hence the need for the toolContentId - * @return SortedMap of ToolOutputDefinitions with the key being the name of each definition - */ - public SortedMap getToolOutputDefinitions(Long toolContentId) throws ToolException { - return new TreeMap(); + scribeDAO.saveOrUpdate(scribe); + } catch (ImportToolContentException e) { + throw new ToolException(e); } + } - /* ********** IScribeService Methods ************************************** */ + /** + * Get the definitions for possible output for an activity, based on the toolContentId. These may be definitions + * that are always available for the tool (e.g. number of marks for Multiple Choice) or a custom definition created + * for a particular activity such as the answer to the third question contains the word Koala and hence the need for + * the toolContentId + * + * @return SortedMap of ToolOutputDefinitions with the key being the name of each definition + */ + public SortedMap getToolOutputDefinitions(Long toolContentId) throws ToolException { + return new TreeMap(); + } - public void createReportEntry(Long toolSessionId){ - // creating scribeReports for each heading and add to session. - ScribeSession session = scribeSessionDAO.getBySessionId(toolSessionId); - - //these heading report already copied from content, the skipit. - Set entries = session.getScribeReportEntries(); - if(entries != null && entries.size() > 0) - return; - - Scribe scribe = session.getScribe(); - Set reports = session.getScribeReportEntries(); - if(reports == null){ - reports = new HashSet(); - session.setScribeReportEntries(reports); - } - for (Iterator iter = scribe.getScribeHeadings().iterator(); iter.hasNext();) { - ScribeHeading heading = (ScribeHeading) iter.next(); - - ScribeReportEntry report = new ScribeReportEntry(); - report.setScribeHeading(heading); - - reports.add(report); - } - scribeSessionDAO.update(session); + /* ********** IScribeService Methods ************************************** */ + public void createReportEntry(Long toolSessionId) { + // creating scribeReports for each heading and add to session. + ScribeSession session = scribeSessionDAO.getBySessionId(toolSessionId); + + // these heading report already copied from content, the skipit. + Set entries = session.getScribeReportEntries(); + if (entries != null && entries.size() > 0) { + return; } - public void deleteHeadingReport(Long uid) { - scribeHeadingDAO.deleteReport(uid); - + + Scribe scribe = session.getScribe(); + Set reports = session.getScribeReportEntries(); + if (reports == null) { + reports = new HashSet(); + session.setScribeReportEntries(reports); } - public Long getDefaultContentIdBySignature(String toolSignature) { - Long toolContentId = null; - toolContentId = new Long(toolService - .getToolDefaultContentIdBySignature(toolSignature)); - if (toolContentId == null) { - String error = "Could not retrieve default content id for this tool"; - logger.error(error); - throw new ScribeException(error); - } - return toolContentId; - } + for (Iterator iter = scribe.getScribeHeadings().iterator(); iter.hasNext();) { + ScribeHeading heading = (ScribeHeading) iter.next(); - public Scribe getDefaultContent() { - Long defaultContentID = getDefaultContentIdBySignature(ScribeConstants.TOOL_SIGNATURE); - Scribe defaultContent = getScribeByContentId(defaultContentID); - if (defaultContent == null) { - String error = "Could not retrieve default content record for this tool"; - logger.error(error); - throw new ScribeException(error); - } - return defaultContent; + ScribeReportEntry report = new ScribeReportEntry(); + report.setScribeHeading(heading); + + reports.add(report); } + scribeSessionDAO.update(session); - public Scribe copyDefaultContent(Long newContentID) { + } - if (newContentID == null) { - String error = "Cannot copy the Scribe tools default content: + " - + "newContentID is null"; - logger.error(error); - throw new ScribeException(error); - } + public void deleteHeadingReport(Long uid) { + scribeHeadingDAO.deleteReport(uid); - Scribe defaultContent = getDefaultContent(); - // create new scribe using the newContentID - Scribe newContent = new Scribe(); - newContent = Scribe.newInstance(defaultContent, newContentID, - scribeToolContentHandler); - scribeDAO.saveOrUpdate(newContent); - return newContent; - } + } - public Scribe getScribeByContentId(Long toolContentID) { - Scribe scribe = (Scribe) scribeDAO.getByContentId(toolContentID); - if (scribe == null) { - logger.debug("Could not find the content with toolContentID:" - + toolContentID); - } - return scribe; + public Long getDefaultContentIdBySignature(String toolSignature) { + Long toolContentId = null; + toolContentId = new Long(toolService.getToolDefaultContentIdBySignature(toolSignature)); + if (toolContentId == null) { + String error = "Could not retrieve default content id for this tool"; + ScribeService.logger.error(error); + throw new ScribeException(error); } + return toolContentId; + } - public ScribeSession getSessionBySessionId(Long toolSessionId) { - ScribeSession scribeSession = scribeSessionDAO.getBySessionId(toolSessionId); - if (scribeSession == null) { - logger.debug("Could not find the scribe session with toolSessionID:" - + toolSessionId); - } - return scribeSession; + public Scribe getDefaultContent() { + Long defaultContentID = getDefaultContentIdBySignature(ScribeConstants.TOOL_SIGNATURE); + Scribe defaultContent = getScribeByContentId(defaultContentID); + if (defaultContent == null) { + String error = "Could not retrieve default content record for this tool"; + ScribeService.logger.error(error); + throw new ScribeException(error); } + return defaultContent; + } - public ScribeUser getUserByUserIdAndSessionId(Long userId, Long toolSessionId) { - return scribeUserDAO.getByUserIdAndSessionId(userId, toolSessionId); + public Scribe copyDefaultContent(Long newContentID) { + + if (newContentID == null) { + String error = "Cannot copy the Scribe tools default content: + " + "newContentID is null"; + ScribeService.logger.error(error); + throw new ScribeException(error); } - public ScribeUser getUserByLoginNameAndSessionId(String loginName, - Long toolSessionId) { - return scribeUserDAO.getByLoginNameAndSessionId(loginName, toolSessionId); + Scribe defaultContent = getDefaultContent(); + // create new scribe using the newContentID + Scribe newContent = new Scribe(); + newContent = Scribe.newInstance(defaultContent, newContentID, scribeToolContentHandler); + scribeDAO.saveOrUpdate(newContent); + return newContent; + } + + public Scribe getScribeByContentId(Long toolContentID) { + Scribe scribe = scribeDAO.getByContentId(toolContentID); + if (scribe == null) { + ScribeService.logger.debug("Could not find the content with toolContentID:" + toolContentID); } + return scribe; + } - public ScribeUser getUserByUID(Long uid) { - return scribeUserDAO.getByUID(uid); + public ScribeSession getSessionBySessionId(Long toolSessionId) { + ScribeSession scribeSession = scribeSessionDAO.getBySessionId(toolSessionId); + if (scribeSession == null) { + ScribeService.logger.debug("Could not find the scribe session with toolSessionID:" + toolSessionId); } + return scribeSession; + } - public ScribeAttachment uploadFileToContent(Long toolContentId, - FormFile file, String type) { - if (file == null || StringUtils.isEmpty(file.getFileName())) - throw new ScribeException("Could not find upload file: " + file); + public ScribeUser getUserByUserIdAndSessionId(Long userId, Long toolSessionId) { + return scribeUserDAO.getByUserIdAndSessionId(userId, toolSessionId); + } - NodeKey nodeKey = processFile(file, type); + public ScribeUser getUserByLoginNameAndSessionId(String loginName, Long toolSessionId) { + return scribeUserDAO.getByLoginNameAndSessionId(loginName, toolSessionId); + } - ScribeAttachment attachment = new ScribeAttachment(); - attachment.setFileType(type); - attachment.setFileUuid(nodeKey.getUuid()); - attachment.setFileVersionId(nodeKey.getVersion()); - attachment.setFileName(file.getFileName()); - attachment.setCreateDate(new Date()); + public ScribeUser getUserByUID(Long uid) { + return scribeUserDAO.getByUID(uid); + } - return attachment; + public ScribeAttachment uploadFileToContent(Long toolContentId, FormFile file, String type) { + if (file == null || StringUtils.isEmpty(file.getFileName())) { + throw new ScribeException("Could not find upload file: " + file); } - public void deleteFromRepository(Long uuid, Long versionID) - throws ScribeException { - ITicket ticket = getRepositoryLoginTicket(); - try { - repositoryService.deleteVersion(ticket, uuid, versionID); - } catch (Exception e) { - throw new ScribeException( - "Exception occured while deleting files from" - + " the repository " + e.getMessage()); - } - } + NodeKey nodeKey = processFile(file, type); - public void deleteInstructionFile(Long contentID, Long uuid, - Long versionID, String type) { - scribeDAO.deleteInstructionFile(contentID, uuid, versionID, type); + ScribeAttachment attachment = new ScribeAttachment(); + attachment.setFileType(type); + attachment.setFileUuid(nodeKey.getUuid()); + attachment.setFileVersionId(nodeKey.getVersion()); + attachment.setFileName(file.getFileName()); + attachment.setCreateDate(new Date()); - } + return attachment; + } - public void saveOrUpdateScribe(Scribe scribe) { - scribeDAO.saveOrUpdate(scribe); + public void deleteFromRepository(Long uuid, Long versionID) throws ScribeException { + ITicket ticket = getRepositoryLoginTicket(); + try { + repositoryService.deleteVersion(ticket, uuid, versionID); + } catch (Exception e) { + throw new ScribeException("Exception occured while deleting files from" + " the repository " + + e.getMessage()); } + } - public void saveOrUpdateScribeSession(ScribeSession scribeSession) { - scribeSessionDAO.saveOrUpdate(scribeSession); - } + public void deleteInstructionFile(Long contentID, Long uuid, Long versionID, String type) { + scribeDAO.deleteInstructionFile(contentID, uuid, versionID, type); - public void saveOrUpdateScribeUser(ScribeUser scribeUser) { - scribeUserDAO.saveOrUpdate(scribeUser); - } + } - public ScribeUser createScribeUser(UserDTO user, - ScribeSession scribeSession) { - ScribeUser scribeUser = new ScribeUser(user, scribeSession); - saveOrUpdateScribeUser(scribeUser); - return scribeUser; - } - - public boolean isGroupedActivity(long toolContentID) { - return toolService.isGroupedActivity(toolContentID); - } + public void saveOrUpdateScribe(Scribe scribe) { + scribeDAO.saveOrUpdate(scribe); + } - public IAuditService getAuditService() { - return auditService; - } + public void saveOrUpdateScribeSession(ScribeSession scribeSession) { + scribeSessionDAO.saveOrUpdate(scribeSession); + } - public void setAuditService(IAuditService auditService) { - this.auditService = auditService; - } + public void saveOrUpdateScribeUser(ScribeUser scribeUser) { + scribeUserDAO.saveOrUpdate(scribeUser); + } - /* ********** Private methods ********** */ - - private NodeKey processFile(FormFile file, String type) { - NodeKey node = null; - if (file != null && !StringUtils.isEmpty(file.getFileName())) { - String fileName = file.getFileName(); - try { - node = getScribeToolContentHandler().uploadFile( - file.getInputStream(), fileName, file.getContentType(), - type); - } catch (InvalidParameterException e) { - throw new ScribeException( - "InvalidParameterException occured while trying to upload File" - + e.getMessage()); - } catch (FileNotFoundException e) { - throw new ScribeException( - "FileNotFoundException occured while trying to upload File" - + e.getMessage()); - } catch (RepositoryCheckedException e) { - throw new ScribeException( - "RepositoryCheckedException occured while trying to upload File" - + e.getMessage()); - } catch (IOException e) { - throw new ScribeException( - "IOException occured while trying to upload File" - + e.getMessage()); - } - } - return node; - } + public ScribeUser createScribeUser(UserDTO user, ScribeSession scribeSession) { + ScribeUser scribeUser = new ScribeUser(user, scribeSession); + saveOrUpdateScribeUser(scribeUser); + return scribeUser; + } - /** - * This method verifies the credentials of the SubmitFiles Tool and gives it - * the Ticket to login and access the Content Repository. - * - * A valid ticket is needed in order to access the content from the - * repository. This method would be called evertime the tool needs to - * upload/download files from the content repository. - * - * @return ITicket The ticket for repostory access - * @throws SubmitFilesException - */ - private ITicket getRepositoryLoginTicket() throws ScribeException { - repositoryService = RepositoryProxy.getRepositoryService(); - ICredentials credentials = new SimpleCredentials( - ScribeToolContentHandler.repositoryUser, - ScribeToolContentHandler.repositoryId); - try { - ITicket ticket = repositoryService.login(credentials, - ScribeToolContentHandler.repositoryWorkspaceName); - return ticket; - } catch (AccessDeniedException ae) { - throw new ScribeException("Access Denied to repository." - + ae.getMessage()); - } catch (WorkspaceNotFoundException we) { - throw new ScribeException("Workspace not found." + we.getMessage()); - } catch (LoginException e) { - throw new ScribeException("Login failed." + e.getMessage()); - } - } + public boolean isGroupedActivity(long toolContentID) { + return toolService.isGroupedActivity(toolContentID); + } - /* ********** Used by Spring to "inject" the linked objects ************* */ + public IAuditService getAuditService() { + return auditService; + } - public IScribeAttachmentDAO getScribeAttachmentDAO() { - return scribeAttachmentDAO; - } + public void setAuditService(IAuditService auditService) { + this.auditService = auditService; + } - public void setScribeAttachmentDAO(IScribeAttachmentDAO attachmentDAO) { - this.scribeAttachmentDAO = attachmentDAO; - } + /* ********** Private methods ********** */ - public IScribeDAO getScribeDAO() { - return scribeDAO; + private NodeKey processFile(FormFile file, String type) { + NodeKey node = null; + if (file != null && !StringUtils.isEmpty(file.getFileName())) { + String fileName = file.getFileName(); + try { + node = getScribeToolContentHandler().uploadFile(file.getInputStream(), fileName, file.getContentType(), + type); + } catch (InvalidParameterException e) { + throw new ScribeException("InvalidParameterException occured while trying to upload File" + + e.getMessage()); + } catch (FileNotFoundException e) { + throw new ScribeException("FileNotFoundException occured while trying to upload File" + e.getMessage()); + } catch (RepositoryCheckedException e) { + throw new ScribeException("RepositoryCheckedException occured while trying to upload File" + + e.getMessage()); + } catch (IOException e) { + throw new ScribeException("IOException occured while trying to upload File" + e.getMessage()); + } } + return node; + } - public void setScribeDAO(IScribeDAO scribeDAO) { - this.scribeDAO = scribeDAO; + /** + * This method verifies the credentials of the SubmitFiles Tool and gives it the Ticket to login and + * access the Content Repository. + * + * A valid ticket is needed in order to access the content from the repository. This method would be called evertime + * the tool needs to upload/download files from the content repository. + * + * @return ITicket The ticket for repostory access + * @throws SubmitFilesException + */ + private ITicket getRepositoryLoginTicket() throws ScribeException { + repositoryService = RepositoryProxy.getRepositoryService(); + ICredentials credentials = new SimpleCredentials(ScribeToolContentHandler.repositoryUser, + ScribeToolContentHandler.repositoryId); + try { + ITicket ticket = repositoryService.login(credentials, ScribeToolContentHandler.repositoryWorkspaceName); + return ticket; + } catch (AccessDeniedException ae) { + throw new ScribeException("Access Denied to repository." + ae.getMessage()); + } catch (WorkspaceNotFoundException we) { + throw new ScribeException("Workspace not found." + we.getMessage()); + } catch (LoginException e) { + throw new ScribeException("Login failed." + e.getMessage()); } + } - public IToolContentHandler getScribeToolContentHandler() { - return scribeToolContentHandler; - } + /* ********** Used by Spring to "inject" the linked objects ************* */ - public void setScribeToolContentHandler( - IToolContentHandler scribeToolContentHandler) { - this.scribeToolContentHandler = scribeToolContentHandler; - } + public IScribeAttachmentDAO getScribeAttachmentDAO() { + return scribeAttachmentDAO; + } - public IScribeSessionDAO getScribeSessionDAO() { - return scribeSessionDAO; - } + public void setScribeAttachmentDAO(IScribeAttachmentDAO attachmentDAO) { + scribeAttachmentDAO = attachmentDAO; + } - public void setScribeSessionDAO(IScribeSessionDAO sessionDAO) { - this.scribeSessionDAO = sessionDAO; - } + public IScribeDAO getScribeDAO() { + return scribeDAO; + } - public ILamsToolService getToolService() { - return toolService; - } + public void setScribeDAO(IScribeDAO scribeDAO) { + this.scribeDAO = scribeDAO; + } - public void setToolService(ILamsToolService toolService) { - this.toolService = toolService; - } + public IToolContentHandler getScribeToolContentHandler() { + return scribeToolContentHandler; + } - public IScribeUserDAO getScribeUserDAO() { - return scribeUserDAO; - } + public void setScribeToolContentHandler(IToolContentHandler scribeToolContentHandler) { + this.scribeToolContentHandler = scribeToolContentHandler; + } - public void setScribeUserDAO(IScribeUserDAO userDAO) { - this.scribeUserDAO = userDAO; - } + public IScribeSessionDAO getScribeSessionDAO() { + return scribeSessionDAO; + } - public ILearnerService getLearnerService() { - return learnerService; - } + public void setScribeSessionDAO(IScribeSessionDAO sessionDAO) { + scribeSessionDAO = sessionDAO; + } - public void setLearnerService(ILearnerService learnerService) { - this.learnerService = learnerService; - } + public ILamsToolService getToolService() { + return toolService; + } - public IExportToolContentService getExportContentService() { - return exportContentService; - } + public void setToolService(ILamsToolService toolService) { + this.toolService = toolService; + } - public void setExportContentService( - IExportToolContentService exportContentService) { - this.exportContentService = exportContentService; - } - - public ICoreNotebookService getCoreNotebookService() { - return coreNotebookService; - } + public IScribeUserDAO getScribeUserDAO() { + return scribeUserDAO; + } - public void setCoreNotebookService(ICoreNotebookService coreNotebookService) { - this.coreNotebookService = coreNotebookService; - } + public void setScribeUserDAO(IScribeUserDAO userDAO) { + scribeUserDAO = userDAO; + } - public Long createNotebookEntry(Long id, Integer idType, String signature, - Integer userID, String entry) { - return coreNotebookService.createNotebookEntry(id, idType, signature, userID, "", entry); - } + public ILearnerService getLearnerService() { + return learnerService; + } - public NotebookEntry getEntry(Long id, Integer idType, String signature, - Integer userID) { - - List list = coreNotebookService.getEntry(id, idType, signature, userID); - if (list == null || list.isEmpty()) { - return null; - } else { - return list.get(0); - } + public void setLearnerService(ILearnerService learnerService) { + this.learnerService = learnerService; + } + + public IExportToolContentService getExportContentService() { + return exportContentService; + } + + public void setExportContentService(IExportToolContentService exportContentService) { + this.exportContentService = exportContentService; + } + + public ICoreNotebookService getCoreNotebookService() { + return coreNotebookService; + } + + public void setCoreNotebookService(ICoreNotebookService coreNotebookService) { + this.coreNotebookService = coreNotebookService; + } + + public Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry) { + return coreNotebookService.createNotebookEntry(id, idType, signature, userID, "", entry); + } + + public NotebookEntry getEntry(Long id, Integer idType, String signature, Integer userID) { + + List list = coreNotebookService.getEntry(id, idType, signature, userID); + if (list == null || list.isEmpty()) { + return null; + } else { + return list.get(0); } - - /* ===============Methods implemented from ToolContentImport102Manager =============== */ - + } + /* ===============Methods implemented from ToolContentImport102Manager =============== */ + /** * Import the data for a 1.0.2 Scribe */ - public void import102ToolContent(Long toolContentId, UserDTO user, Hashtable importValues) - { - Date now = new Date(); - Scribe scribe = new Scribe(); - scribe.setContentInUse(Boolean.FALSE); - scribe.setCreateBy(new Long(user.getUserID().longValue())); - scribe.setCreateDate(now); - scribe.setDefineLater(Boolean.FALSE); - scribe.setInstructions(null); - scribe.setOfflineInstructions(null); - scribe.setOnlineInstructions(null); - scribe.setReflectInstructions(null); - scribe.setReflectOnActivity(Boolean.FALSE); - scribe.setRunOffline(Boolean.FALSE); - scribe.setTitle((String)importValues.get(ToolContentImport102Manager.CONTENT_TITLE)); - scribe.setToolContentId(toolContentId); - scribe.setUpdateDate(now); - scribe.setAutoSelectScribe(true); - - try { - Boolean isReusable = WDDXProcessor.convertToBoolean(importValues, ToolContentImport102Manager.CONTENT_REUSABLE); - scribe.setLockOnFinished(isReusable != null ? ! isReusable.booleanValue() : true); - } catch (WDDXProcessorConversionException e) { - logger.error("Unable to content for activity "+scribe.getTitle()+"properly due to a WDDXProcessorConversionException.",e); - throw new ToolException("Invalid import data format for activity "+scribe.getTitle()+"- WDDX caused an exception. Some data from the design will have been lost. See log for more details."); - } + public void import102ToolContent(Long toolContentId, UserDTO user, Hashtable importValues) { + Date now = new Date(); + Scribe scribe = new Scribe(); + scribe.setContentInUse(Boolean.FALSE); + scribe.setCreateBy(new Long(user.getUserID().longValue())); + scribe.setCreateDate(now); + scribe.setDefineLater(Boolean.FALSE); + scribe.setInstructions(null); + scribe.setOfflineInstructions(null); + scribe.setOnlineInstructions(null); + scribe.setReflectInstructions(null); + scribe.setReflectOnActivity(Boolean.FALSE); + scribe.setRunOffline(Boolean.FALSE); + scribe.setTitle((String) importValues.get(ToolContentImport102Manager.CONTENT_TITLE)); + scribe.setToolContentId(toolContentId); + scribe.setUpdateDate(now); + scribe.setAutoSelectScribe(true); - String headingList = (String)importValues.get(ToolContentImport102Manager.CONTENT_BODY); - if (headingList != null && headingList.length()>0) { - String[] headings = headingList.split("\\^"); - Set set = new HashSet(); - for (int i=0; i < headings.length ; i++) { - ScribeHeading sHeading = new ScribeHeading(); - sHeading.setDisplayOrder(i); - sHeading.setHeadingText(WebUtil.convertNewlines(headings[i])); - sHeading.setScribe(scribe); - set.add(sHeading); - } - scribe.setScribeHeadings(set); - } - - // leave as empty, no need to set them to anything. - //setScribeAttachments(Set scribeAttachments); - //setScribeSessions(Set scribeSessions); - scribeDAO.saveOrUpdate(scribe); + try { + Boolean isReusable = WDDXProcessor.convertToBoolean(importValues, + ToolContentImport102Manager.CONTENT_REUSABLE); + scribe.setLockOnFinished(isReusable != null ? !isReusable.booleanValue() : true); + } catch (WDDXProcessorConversionException e) { + ScribeService.logger.error("Unable to content for activity " + scribe.getTitle() + + "properly due to a WDDXProcessorConversionException.", e); + throw new ToolException( + "Invalid import data format for activity " + + scribe.getTitle() + + "- WDDX caused an exception. Some data from the design will have been lost. See log for more details."); + } + + String headingList = (String) importValues.get(ToolContentImport102Manager.CONTENT_BODY); + if (headingList != null && headingList.length() > 0) { + String[] headings = headingList.split("\\^"); + Set set = new HashSet(); + for (int i = 0; i < headings.length; i++) { + ScribeHeading sHeading = new ScribeHeading(); + sHeading.setDisplayOrder(i); + sHeading.setHeadingText(WebUtil.convertNewlines(headings[i])); + sHeading.setScribe(scribe); + set.add(sHeading); + } + scribe.setScribeHeadings(set); + } + + // leave as empty, no need to set them to anything. + // setScribeAttachments(Set scribeAttachments); + // setScribeSessions(Set scribeSessions); + scribeDAO.saveOrUpdate(scribe); } /** Set the description, throws away the title value as this is not supported in 2.0 */ - public void setReflectiveData(Long toolContentId, String title, String description) - throws ToolException, DataMissingException { - - Scribe scribe = getScribeByContentId(toolContentId); - if ( scribe == null ) { - throw new DataMissingException("Unable to set reflective data titled "+title - +" on activity toolContentId "+toolContentId - +" as the tool content does not exist."); - } - - scribe.setReflectOnActivity(Boolean.TRUE); - scribe.setReflectInstructions(description); - } - //========================================================================================= + public void setReflectiveData(Long toolContentId, String title, String description) throws ToolException, + DataMissingException { - public void setScribeHeadingDAO(IScribeHeadingDAO scribeHeadingDAO) { - this.scribeHeadingDAO = scribeHeadingDAO; + Scribe scribe = getScribeByContentId(toolContentId); + if (scribe == null) { + throw new DataMissingException("Unable to set reflective data titled " + title + + " on activity toolContentId " + toolContentId + " as the tool content does not exist."); } + + scribe.setReflectOnActivity(Boolean.TRUE); + scribe.setReflectInstructions(description); + } + + // ========================================================================================= + + public void setScribeHeadingDAO(IScribeHeadingDAO scribeHeadingDAO) { + this.scribeHeadingDAO = scribeHeadingDAO; + } + + public void deleteHeading(Long headingUid) { + scribeHeadingDAO.deleteById(ScribeHeading.class, headingUid); + } } \ No newline at end of file Index: lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/web/actions/PedagogicalPlannerAction.java =================================================================== diff -u --- lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/web/actions/PedagogicalPlannerAction.java (revision 0) +++ lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/web/actions/PedagogicalPlannerAction.java (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -0,0 +1,163 @@ +/**************************************************************** + * 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 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$$ */ + +package org.lamsfoundation.lams.tool.scribe.web.actions; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessages; +import org.lamsfoundation.lams.tool.scribe.model.Scribe; +import org.lamsfoundation.lams.tool.scribe.model.ScribeHeading; +import org.lamsfoundation.lams.tool.scribe.service.IScribeService; +import org.lamsfoundation.lams.tool.scribe.service.ScribeServiceProxy; +import org.lamsfoundation.lams.tool.scribe.web.forms.ScribePedagogicalPlannerForm; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.action.LamsDispatchAction; +import org.lamsfoundation.lams.web.util.AttributeNames; + +/** + * @author + * @version + * + * @struts.action path="/pedagogicalPlanner" name="pedagogicalPlannerForm" parameter="dispatch" scope="request" + * validate="false" + * + * @struts.action-forward name="success" path="/pages/authoring/pedagogicalPlannerForm.jsp" + */ +public class PedagogicalPlannerAction extends LamsDispatchAction { + + private static Logger logger = Logger.getLogger(PedagogicalPlannerAction.class); + public IScribeService scribeService; + + @Override + protected ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + return initPedagogicalPlannerForm(mapping, form, request, response); + } + + public ActionForward initPedagogicalPlannerForm(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + ScribePedagogicalPlannerForm plannerForm = (ScribePedagogicalPlannerForm) form; + Long toolContentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); + Scribe scribe = getScribeService().getScribeByContentId(toolContentID); + String command = WebUtil.readStrParam(request, AttributeNames.PARAM_COMMAND, true); + if (command == null) { + plannerForm.fillForm(scribe); + String contentFolderId = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + plannerForm.setContentFolderID(contentFolderId); + return mapping.findForward("success"); + } else { + try { + String onlineInstructions = scribe.getOnlineInstructions(); + response.setContentType("text/html;charset=utf-8"); + PrintWriter writer = response.getWriter(); + + if (AttributeNames.COMMAND_CHECK_EDITING_ADVICE.equals(command)) { + Integer activityIndex = WebUtil.readIntParam(request, AttributeNames.PARAM_ACTIVITY_INDEX); + String responseText = (StringUtils.isEmpty(scribe.getOnlineInstructions()) ? "NO" : "OK") + '&' + + activityIndex; + writer.print(responseText); + + } else if (AttributeNames.COMMAND_GET_EDITING_ADVICE.equals(command)) { + writer.print(onlineInstructions); + } + } catch (IOException e) { + LamsDispatchAction.log.error(e); + } + return null; + } + + } + + public ActionForward saveOrUpdatePedagogicalPlannerForm(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws IOException { + ScribePedagogicalPlannerForm plannerForm = (ScribePedagogicalPlannerForm) form; + ActionMessages errors = plannerForm.validate(); + if (errors.isEmpty()) { + Scribe scribe = getScribeService().getScribeByContentId(plannerForm.getToolContentID()); + + int headingIndex = 0; + String heading = null; + ScribeHeading scribeHeading = null; + List newHeadings = new LinkedList(); + Iterator scribeHeadingIterator = scribe.getScribeHeadings().iterator(); + do { + heading = plannerForm.getHeading(headingIndex); + if (StringUtils.isEmpty(heading)) { + plannerForm.removeHeading(headingIndex); + } else { + if (scribeHeadingIterator.hasNext()) { + scribeHeading = scribeHeadingIterator.next(); + scribeHeading.setDisplayOrder(headingIndex); + } else { + scribeHeading = new ScribeHeading(); + scribeHeading.setHeadingText(heading); + scribeHeading.setDisplayOrder(headingIndex); + + newHeadings.add(scribeHeading); + scribeHeading.setScribe(scribe); + } + headingIndex++; + } + + } while (heading != null); + while (scribeHeadingIterator.hasNext()) { + scribeHeading = scribeHeadingIterator.next(); + scribeHeadingIterator.remove(); + getScribeService().deleteHeading(scribeHeading.getUid()); + } + scribe.getScribeHeadings().addAll(newHeadings); + getScribeService().saveOrUpdateScribe(scribe); + } else { + saveErrors(request, errors); + } + return mapping.findForward("success"); + } + + public ActionForward createPedagogicalPlannerHeading(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) { + ScribePedagogicalPlannerForm plannerForm = (ScribePedagogicalPlannerForm) form; + plannerForm.setHeading(plannerForm.getHeadingCount().intValue(), ""); + return mapping.findForward("success"); + } + + private IScribeService getScribeService() { + if (scribeService == null) { + scribeService = ScribeServiceProxy.getScribeService(this.getServlet().getServletContext()); + } + return scribeService; + } +} \ No newline at end of file Index: lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/web/forms/ScribePedagogicalPlannerForm.java =================================================================== diff -u --- lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/web/forms/ScribePedagogicalPlannerForm.java (revision 0) +++ lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/web/forms/ScribePedagogicalPlannerForm.java (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -0,0 +1,106 @@ +/**************************************************************** + * 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$ */ +package org.lamsfoundation.lams.tool.scribe.web.forms; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import org.apache.struts.action.ActionMessages; +import org.lamsfoundation.lams.tool.scribe.model.Scribe; +import org.lamsfoundation.lams.tool.scribe.model.ScribeHeading; +import org.lamsfoundation.lams.web.planner.PedagogicalPlannerActivityForm; + +/** + * @struts.form name="pedagogicalPlannerForm" + */ +public class ScribePedagogicalPlannerForm extends PedagogicalPlannerActivityForm { + private List headings; + private String contentFolderID; + + @Override + public ActionMessages validate() { + ActionMessages errors = new ActionMessages(); + boolean valid = true; + + setValid(valid); + return errors; + } + + public void fillForm(Scribe scribe) { + if (scribe != null) { + setToolContentID(scribe.getToolContentId()); + headings = new ArrayList(); + Set scribeHeadings = scribe.getScribeHeadings(); + + if (scribeHeadings != null) { + int headingIndex = 0; + for (ScribeHeading heading : scribeHeadings) { + setHeading(headingIndex++, heading.getHeadingText()); + } + } + } + } + + public void setHeading(int number, String heading) { + if (headings == null) { + headings = new ArrayList(); + } + while (number >= headings.size()) { + headings.add(null); + } + headings.set(number, heading); + } + + public String getHeading(int number) { + if (headings == null || number >= headings.size()) { + return null; + } + return headings.get(number); + } + + public Integer getHeadingCount() { + return headings == null ? 0 : headings.size(); + } + + public boolean removeHeading(int number) { + if (headings == null || number >= headings.size()) { + return false; + } + headings.remove(number); + return true; + } + + public String getContentFolderID() { + return contentFolderID; + } + + public void setContentFolderID(String contentFolderID) { + this.contentFolderID = contentFolderID; + } + + public List getHeadingList() { + return headings; + } +} \ No newline at end of file Index: lams_tool_scribe/web/pages/authoring/pedagogicalPlannerForm.jsp =================================================================== diff -u --- lams_tool_scribe/web/pages/authoring/pedagogicalPlannerForm.jsp (revision 0) +++ lams_tool_scribe/web/pages/authoring/pedagogicalPlannerForm.jsp (revision 8f7975d272f91acc26c785848d82d26d6b5dd357) @@ -0,0 +1,80 @@ + + +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + + + + + + + +

+
+ +

+ +
+ + +
+
+
+
+
+ + +
\ No newline at end of file