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());
+ }
+ }
+
+ /* ********** Used by Spring to "inject" the linked objects ************* */
+
+ public IScribeAttachmentDAO getScribeAttachmentDAO() {
+ return scribeAttachmentDAO;
+ }
+
+ public void setScribeAttachmentDAO(IScribeAttachmentDAO attachmentDAO) {
+ this.scribeAttachmentDAO = attachmentDAO;
+ }
+
+ public IScribeDAO getScribeDAO() {
+ return scribeDAO;
+ }
+
+ public void setScribeDAO(IScribeDAO scribeDAO) {
+ this.scribeDAO = scribeDAO;
+ }
+
+ public IToolContentHandler getScribeToolContentHandler() {
+ return scribeToolContentHandler;
+ }
+
+ public void setScribeToolContentHandler(
+ IToolContentHandler scribeToolContentHandler) {
+ this.scribeToolContentHandler = scribeToolContentHandler;
+ }
+
+ public IScribeSessionDAO getScribeSessionDAO() {
+ return scribeSessionDAO;
+ }
+
+ public void setScribeSessionDAO(IScribeSessionDAO sessionDAO) {
+ this.scribeSessionDAO = sessionDAO;
+ }
+
+ public ILamsToolService getToolService() {
+ return toolService;
+ }
+
+ public void setToolService(ILamsToolService toolService) {
+ this.toolService = toolService;
+ }
+
+ public IScribeUserDAO getScribeUserDAO() {
+ return scribeUserDAO;
+ }
+
+ public void setScribeUserDAO(IScribeUserDAO userDAO) {
+ this.scribeUserDAO = userDAO;
+ }
+
+ public ILearnerService getLearnerService() {
+ return learnerService;
+ }
+
+ 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) {
+
+ ListThis 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.
+ */ + +public class ScribeServiceProxy { + + public static final IScribeService getScribeService(ServletContext servletContext) + { + return (IScribeService)getScribeDomainService(servletContext); + } + + private static Object getScribeDomainService(ServletContext servletContext) + { + WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); + return wac.getBean("lascrbScribeService"); + } + + /* + * Return the scribe tool version of tool session manager implementation. + * 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 noticeboard service object.*/ + public static final ToolSessionManager getScribeSessionManager(ServletContext servletContext) + { + return (ToolSessionManager)getScribeDomainService(servletContext); + } + + + /* + * Return the scribe tool version of tool content manager implementation. + * 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 noticeboard service object. */ + public static final ToolContentManager getScribeContentManager(ServletContext servletContext) + { + return (ToolContentManager)getScribeDomainService(servletContext); + } + +} Index: lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/util/ScribeConstants.java =================================================================== diff -u --- lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/util/ScribeConstants.java (revision 0) +++ lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/util/ScribeConstants.java (revision 676776bec1c35957910e6911d9f7d280f646d28d) @@ -0,0 +1,51 @@ +/**************************************************************** + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ +/* $$Id$ */ + +package org.lamsfoundation.lams.tool.scribe.util; + + +public interface ScribeConstants { + public static final String TOOL_SIGNATURE = "lascrb11"; + + // Scribe session status + public static final Integer SESSION_NOT_STARTED = new Integer(0); + public static final Integer SESSION_IN_PROGRESS = new Integer(1); + public static final Integer SESSION_COMPLETED = new Integer(2); + + public static final String AUTHORING_DEFAULT_TAB = "1"; + public static final String ATTACHMENT_LIST = "attachmentList"; + public static final String DELETED_ATTACHMENT_LIST = "deletedAttachmentList"; + public static final String AUTH_SESSION_ID_COUNTER = "authoringSessionIdCounter"; + public static final String AUTH_SESSION_ID = "authoringSessionId"; + + public static final int MONITORING_SUMMARY_MAX_MESSAGES = 5; + + // Attribute names + public static final String ATTR_MESSAGE = "message"; + public static final String ATTR_SESSION_MAP = "sessionMap"; + + // Parameter names + public static final String PARAM_PARENT_PAGE = "parentPage"; + +} Index: lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/util/ScribeException.java =================================================================== diff -u --- lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/util/ScribeException.java (revision 0) +++ lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/util/ScribeException.java (revision 676776bec1c35957910e6911d9f7d280f646d28d) @@ -0,0 +1,57 @@ +/**************************************************************** + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ +/* $$Id$ */ + +package org.lamsfoundation.lams.tool.scribe.util; + +/** + * + * @author Anthony Sukkar + * + */ +public class ScribeException extends RuntimeException { + + /** + * + */ + private static final long serialVersionUID = -5518806968051758859L; + + public ScribeException(String message) { + super(message); + } + + public ScribeException(String message, Throwable cause) { + super(message, cause); + } + + public ScribeException() { + super(); + + } + + public ScribeException(Throwable cause) { + super(cause); + + } + +} Index: lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/util/ScribeToolContentHandler.java =================================================================== diff -u --- lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/util/ScribeToolContentHandler.java (revision 0) +++ lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/util/ScribeToolContentHandler.java (revision 676776bec1c35957910e6911d9f7d280f646d28d) @@ -0,0 +1,76 @@ +/**************************************************************** + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ +/* $$Id$ */ + +package org.lamsfoundation.lams.tool.scribe.util; + +import org.lamsfoundation.lams.contentrepository.client.ToolContentHandler; + +/** + * Simple client for accessing the content repository. + */ +public class ScribeToolContentHandler extends ToolContentHandler { + + // TODO these three fields were changed to public, since accessor methods + // cannot be made static. Check if we can do this a better way. + public static String repositoryWorkspaceName = "scribeworkspace"; + + public static String repositoryUser = "scribe"; + + public static char[] repositoryId = { 'l', 'a', 'm', 's', '-', 'e', 'x' }; + + /** + * + */ + public ScribeToolContentHandler() { + super(); + } + + /* + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryWorkspaceName() + */ + public String getRepositoryWorkspaceName() { + return repositoryWorkspaceName; + } + + /* + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryUser() + */ + public String getRepositoryUser() { + return repositoryUser; + } + + /* + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryId() + */ + public char[] getRepositoryId() { + return repositoryId; + } + +} Index: lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/web/actions/AuthoringAction.java =================================================================== diff -u --- lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/web/actions/AuthoringAction.java (revision 0) +++ lams_tool_scribe/src/java/org/lamsfoundation/lams/tool/scribe/web/actions/AuthoringAction.java (revision 676776bec1c35957910e6911d9f7d280f646d28d) @@ -0,0 +1,473 @@ +/**************************************************************** + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ +/* $$Id$ */ + +package org.lamsfoundation.lams.tool.scribe.web.actions; + +import java.util.Date; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; + +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.upload.FormFile; +import org.lamsfoundation.lams.authoring.web.AuthoringConstants; +import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; +import org.lamsfoundation.lams.tool.ToolAccessMode; +import org.lamsfoundation.lams.tool.scribe.model.Scribe; +import org.lamsfoundation.lams.tool.scribe.model.ScribeAttachment; +import org.lamsfoundation.lams.tool.scribe.service.ScribeServiceProxy; +import org.lamsfoundation.lams.tool.scribe.service.IScribeService; +import org.lamsfoundation.lams.tool.scribe.util.ScribeConstants; +import org.lamsfoundation.lams.tool.scribe.web.forms.AuthoringForm; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.action.LamsDispatchAction; +import org.lamsfoundation.lams.web.util.AttributeNames; +import org.lamsfoundation.lams.web.util.SessionMap; + + +/** + * @author + * @version + * + * @struts.action path="/authoring" name="authoringForm" parameter="dispatch" + * scope="request" validate="false" + * + * @struts.action-forward name="success" path="tiles:/authoring/main" + * @struts.action-forward name="message_page" path="tiles:/generic/message" + */ +public class AuthoringAction extends LamsDispatchAction { + + private static Logger logger = Logger.getLogger(AuthoringAction.class); + + public IScribeService scribeService; + + // Authoring SessionMap key names + private static final String KEY_MODE = "mode"; + + private static final String KEY_ONLINE_FILES = "onlineFiles"; + + private static final String KEY_OFFLINE_FILES = "offlineFiles"; + + private static final String KEY_UNSAVED_ONLINE_FILES = "unsavedOnlineFiles"; + + private static final String KEY_UNSAVED_OFFLINE_FILES = "unsavedOfflineFiles"; + + private static final String KEY_DELETED_FILES = "deletedFiles"; + + /** + * Default method when no dispatch parameter is specified. It is expected + * that the parametertoolContentID
will be passed in. This
+ * will be used to retrieve content for this tool.
+ *
+ */
+ protected ActionForward unspecified(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response) {
+
+ // Extract toolContentID from parameters.
+ Long toolContentID = new Long(WebUtil.readLongParam(request,
+ AttributeNames.PARAM_TOOL_CONTENT_ID));
+
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+
+ // set up scribeService
+ if (scribeService == null) {
+ scribeService = ScribeServiceProxy.getScribeService(this.getServlet()
+ .getServletContext());
+ }
+
+ // retrieving Scribe with given toolContentID
+ Scribe scribe = scribeService.getScribeByContentId(toolContentID);
+ if (scribe == null) {
+ scribe = scribeService.copyDefaultContent(toolContentID);
+ scribe.setCreateDate(new Date());
+ scribeService.saveOrUpdateScribe(scribe);
+ // TODO NOTE: this causes DB orphans when LD not saved.
+ }
+
+ // check if content in use is set
+ if (scribe.getContentInUse()) {
+ // Cannot edit, send to message page.
+ request.setAttribute(ScribeConstants.ATTR_MESSAGE, getResources(
+ request).getMessage("error.content.locked"));
+ return mapping.findForward("message_page");
+ }
+
+ // Set the defineLater flag so that learners cannot use content while we
+ // are editing. This flag is released when updateContent is called.
+ scribe.setDefineLater(true);
+ scribeService.saveOrUpdateScribe(scribe);
+
+ // Set up the authForm.
+ AuthoringForm authForm = (AuthoringForm) form;
+ updateAuthForm(authForm, scribe);
+
+ // Set up sessionMap
+ SessionMap
+
+ +
Copyright (C) 2006 LAMS Foundation (http://lamsfoundation.org
Index: lams_tool_scribe/web/common/header.jsp =================================================================== diff -u --- lams_tool_scribe/web/common/header.jsp (revision 0) +++ lams_tool_scribe/web/common/header.jsp (revision 676776bec1c35957910e6911d9f7d280f646d28d) @@ -0,0 +1,17 @@ +<%@ include file="/common/taglibs.jsp"%> + ++ ${requestScope.message}; +
Index: lams_tool_scribe/web/common/taglibs.jsp =================================================================== diff -u --- lams_tool_scribe/web/common/taglibs.jsp (revision 0) +++ lams_tool_scribe/web/common/taglibs.jsp (revision 676776bec1c35957910e6911d9f7d280f646d28d) @@ -0,0 +1,12 @@ +<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%> + +<%@ taglib uri="tags-bean" prefix="bean"%> +<%@ taglib uri="tags-logic" prefix="logic"%> +<%@ taglib uri="tags-tiles" prefix="tiles"%> +<%@ taglib uri="tags-html" prefix="html"%> +<%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-function" prefix="fn" %> +<%@ taglib uri="tags-fmt" prefix="fmt"%> +<%@ taglib uri="tags-lams" prefix="lams"%> +<%@ taglib uri="fck-editor" prefix="fck"%> + Index: lams_tool_scribe/web/error.jsp =================================================================== diff -u --- lams_tool_scribe/web/error.jsp (revision 0) +++ lams_tool_scribe/web/error.jsp (revision 676776bec1c35957910e6911d9f7d280f646d28d) @@ -0,0 +1,69 @@ + + +<%@ page language="java" isErrorPage="true" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%> +<%@ taglib uri="tags-lams" prefix="lams"%> +<%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-fmt" prefix="fmt"%> +
+ |
+ + + | +
+ |
+ + + | +
+ + | +
+ |
+
+
+
+ |
+ |
+ |
+
+ |
+
+ |
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+ + | +
+
+
+ |
+
+ + | +
+
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+ + | +
+
+
+ |
+
+
+
+ |
+
+
+ ${user.firstName}
+ ${user.lastName}
+
+ ${user.notebookEntry}
+
+ Scribe Learning Page +
+ ++ ${scribeDTO.reflectInstructions} + | +
+ |
+
+ |
+
+ ${scribeUserDTO.notebookEntry} +
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+
+ |
+
+ |
+
+ + | + ++ + | +
+ |
+
+ |
+
+ + | + ++ + | +
+ + ${scribeUserDTO.firstName} ${scribeUserDTO.lastName} ++ |
+
+ ${scribeUserDTO.notebookEntry} + |
+
+ ${session.sessionName}+ |
+ |
+ |
+ + ${session.numberOfLearners} + | +
+ |
+ + ${session.numberOfPosts} + | +
+ |
+
+ |
+
---|---|
+ ${user.jabberNickname} + | ++ ${user.postCount} + | +
+ + ${session.sessionName} ++ |
+ ||
+ |
+ + ${session.numberOfLearners} + | +|
+ |
+ + ${session.numberOfPosts} + | +|
+
+
+ |
+ ||
+ |
+ ||
+ + Reflections ++ |
+ ||
+ |
+
+ |
+
+
+ |
+
---|---|---|
+ ${user.jabberNickname} + | ++ ${user.postCount} + | +
+ |
+
+
+
+
+
+
+
+ |
+