Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/ApplicationResources.properties
===================================================================
diff -u -r86b5cdd388fcafe54ad59646071e12166c3757a1 -r2933e1ad39938f2c65040e8bf0199c5161e85c1f
--- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/ApplicationResources.properties (.../ApplicationResources.properties) (revision 86b5cdd388fcafe54ad59646071e12166c3757a1)
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/ApplicationResources.properties (.../ApplicationResources.properties) (revision 2933e1ad39938f2c65040e8bf0199c5161e85c1f)
@@ -17,24 +17,36 @@
instructions.uploadOnlineInstr=Upload Online Instructions:
instructions.uploadOfflineInstr=Upload Offline Instructions:
-#buttons
-button.cancel=Cancel
-button.ok=OK
-button.done=Done
-button.finish=Finish
-button.next=Next
-
-#Exception Messages
-error.missingParam={0} missing. Unable to continue.
-
-#Messages displayed to user
+# ========== Learner Page ==========
message.defineLaterSet=Please wait for the teacher to complete the contents of this activity
message.runOfflineSet=This activity is not being done on the computer. Please see your instructor for details
#Messages displayed to Author
message.author.defineLaterSet1=This feature is not available in the preview mode.
message.author.defineLaterSet2=The teacher will set the content of this noticeboard once the lesson is in progress. Please click on the "NEXT" button below to continue
+# ========== Monitoring Page ==========
+button.summary=Summary
+button.editActivity=Edit Activity
+button.statistics=Statistics
+button.edit=Edit
-#Error Messages
+titleHeading.summary=Summary
+titleHeading.instructions=Instructions
+titleHeading.statistics=Statistics
+titleHeading.editActivity=Edit Activity
+
+message.contentInUseSet=The modification of content is not allowed since one or more students has attempted the activity.
+message.summary=There is no summary available for this tool.
+
+# ========== Buttons ==========
+button.cancel=Cancel
+button.ok=OK
+button.done=Done
+button.finish=Finish
+button.next=Next
+
+
+# ========== Error/Exception Messages ==========
+error.missingParam={0} missing. Unable to continue.
error.exception.NbApplication=An internal error has occured with the Noticeboard Tool. If reporting this error, please report:
{0}
\ No newline at end of file
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbMonitoringAction.java
===================================================================
diff -u
--- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbMonitoringAction.java (revision 0)
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbMonitoringAction.java (revision 2933e1ad39938f2c65040e8bf0199c5161e85c1f)
@@ -0,0 +1,197 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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
+ */
+
+/*
+ * Created on Jul 14, 2005
+ *
+ */
+package org.lamsfoundation.lams.tool.noticeboard.web;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+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.actions.LookupDispatchAction;
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardConstants;
+import org.lamsfoundation.lams.tool.noticeboard.service.INoticeboardService;
+import org.lamsfoundation.lams.tool.noticeboard.service.NoticeboardServiceProxy;
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent;
+import org.lamsfoundation.lams.tool.noticeboard.util.NbMonitoringUtil;
+import org.lamsfoundation.lams.tool.noticeboard.NbApplicationException;
+
+/**
+ * @author mtruong
+ *
+ */
+
+/**
+ * Creation Date: 14-07-05
+ *
+ * ----------------XDoclet Tags--------------------
+ *
+ * @struts:action path="/tool/nb/monitoring" name="NbMonitoringForm" scope="session" type="org.lamsfoundation.lams.tool.noticeboard.web.NbMonitoringAction"
+ * input=".monitoringContent" validate="false" parameter="method"
+ * @struts:action-forward name="monitorPage" path=".monitoringContent"
+ * ----------------XDoclet Tags--------------------
+ */
+public class NbMonitoringAction extends LookupDispatchAction {
+
+ static Logger logger = Logger.getLogger(NbMonitoringAction.class.getName());
+
+ protected Map getKeyMethodMap()
+ {
+ Map map = new HashMap();
+ map.put(NoticeboardConstants.BUTTON_EDIT_ACTIVITY, "editActivity");
+ map.put(NoticeboardConstants.BUTTON_INSTRUCTIONS, "instructions");
+ map.put(NoticeboardConstants.BUTTON_STATISTICS, "statistics");
+ map.put(NoticeboardConstants.BUTTON_SUMMARY, "summary");
+ return map;
+ }
+
+ /**
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ public ActionForward editActivity(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ NbMonitoringForm monitorForm = (NbMonitoringForm)form;
+
+ Long toolContentId = (Long)request.getSession().getAttribute(NoticeboardConstants.TOOL_CONTENT_ID_INMONITORMODE);
+ INoticeboardService nbService = NoticeboardServiceProxy.getNbService(getServlet().getServletContext());
+ NoticeboardContent content = nbService.retrieveNoticeboard(toolContentId);
+
+ if (isContentEditable(content))
+ {
+ request.getSession().removeAttribute(NoticeboardConstants.CONTENT_IN_USE);
+
+ request.getSession().setAttribute(NoticeboardConstants.TITLE, content.getTitle());
+ request.getSession().setAttribute(NoticeboardConstants.CONTENT, content.getContent());
+ }
+ else
+ {
+ request.getSession().setAttribute(NoticeboardConstants.CONTENT_IN_USE, "true");
+ }
+ //copyValuesIntoSession(request, content);
+
+ return mapping.findForward(NoticeboardConstants.MONITOR_PAGE);
+ }
+
+ /**
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ public ActionForward instructions(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ NbMonitoringForm monitorForm = (NbMonitoringForm)form;
+ // NbMonitoringUtil.cleanSession(request);
+ Long toolContentId = (Long)request.getSession().getAttribute(NoticeboardConstants.TOOL_CONTENT_ID_INMONITORMODE);
+ INoticeboardService nbService = NoticeboardServiceProxy.getNbService(getServlet().getServletContext());
+ NoticeboardContent content = nbService.retrieveNoticeboard(toolContentId);
+ //copyValuesIntoSession(request, content);
+
+ request.getSession().setAttribute(NoticeboardConstants.ONLINE_INSTRUCTIONS, content.getOnlineInstructions());
+ request.getSession().setAttribute(NoticeboardConstants.OFFLINE_INSTRUCTIONS, content.getOfflineInstructions());
+
+ return mapping.findForward(NoticeboardConstants.MONITOR_PAGE);
+ }
+
+ /**
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ public ActionForward summary(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ return mapping.findForward(NoticeboardConstants.MONITOR_PAGE);
+ }
+
+ /**
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ public ActionForward statistics(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ return mapping.findForward(NoticeboardConstants.MONITOR_PAGE);
+ }
+
+ /**
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private void copyValuesIntoSession(HttpServletRequest request, NoticeboardContent content)
+ {
+ request.getSession().setAttribute(NoticeboardConstants.TITLE, content.getTitle());
+ request.getSession().setAttribute(NoticeboardConstants.CONTENT, content.getContent());
+ request.getSession().setAttribute(NoticeboardConstants.ONLINE_INSTRUCTIONS, content.getOnlineInstructions());
+ request.getSession().setAttribute(NoticeboardConstants.OFFLINE_INSTRUCTIONS, content.getOfflineInstructions());
+ }
+
+ /**
+ *
This method checks the two tool content flags, defineLater and contentInUse
+ * to determine whether the tool content is modifiable or not. Returns true is content is
+ * modifiable and false otherwise
+ *
Tool content is modifiable if:
+ *