Index: lams_build/lib/pedagogical_planner/1/1/1/LAMS_Pedagogical_Planner_Template.zip =================================================================== RCS file: /usr/local/cvsroot/lams_build/lib/pedagogical_planner/1/1/1/Attic/LAMS_Pedagogical_Planner_Template.zip,v diff -u -r1.3 -r1.4 Binary files differ Index: lams_central/web/includes/javascript/pedagogicalPlanner.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/pedagogicalPlanner.js,v diff -u -r1.3 -r1.4 --- lams_central/web/includes/javascript/pedagogicalPlanner.js 20 Jan 2009 17:21:51 -0000 1.3 +++ lams_central/web/includes/javascript/pedagogicalPlanner.js 21 Jan 2009 22:17:08 -0000 1.4 @@ -56,8 +56,14 @@ //Submit single activity function submitActivityForm(activityIndex){ - var form = $('#activity'+activityIndex).contents().find('#pedagogicalPlannerForm'); + var activity = document.getElementById('activity'+activityIndex); + var form = $(activity).contents().find('#pedagogicalPlannerForm'); if (form.length > 0){ + //check if activity has a special function that needs to be run before submit + if (activity.contentWindow.prepareFormData){ + activity.contentWindow.prepareFormData(); + } + //prepareFormData above is inside the tool and the one below is here, triggered by jQuery form.ajaxSubmit({ beforeSubmit: prepareFormData, success: onActivityResponse, Index: lams_tool_wiki/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/.classpath,v diff -u -r1.2 -r1.3 --- lams_tool_wiki/.classpath 30 Oct 2008 03:48:31 -0000 1.2 +++ lams_tool_wiki/.classpath 21 Jan 2009 22:17:04 -0000 1.3 @@ -9,5 +9,7 @@ + + Index: lams_tool_wiki/build.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/build.properties,v diff -u -r1.1 -r1.2 --- lams_tool_wiki/build.properties 8 Oct 2008 05:33:01 -0000 1.1 +++ lams_tool_wiki/build.properties 21 Jan 2009 22:17:04 -0000 1.2 @@ -3,7 +3,7 @@ signature=lawiki10 #project version -tool.version=20080929 +tool.version=20090121 package=org/lamsfoundation/lams/tool/wiki package.name=org.lamsfoundation.lams.tool.wiki Index: lams_tool_wiki/db/sql/tool_insert.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/db/sql/tool_insert.sql,v diff -u -r1.2 -r1.3 --- lams_tool_wiki/db/sql/tool_insert.sql 10 Oct 2008 05:42:09 -0000 1.2 +++ lams_tool_wiki/db/sql/tool_insert.sql 21 Jan 2009 22:17:04 -0000 1.3 @@ -23,6 +23,7 @@ export_pfolio_class_url, contribute_url, moderation_url, +pedagogical_planner_url, help_url, language_file, classpath_addition, @@ -54,6 +55,7 @@ 'tool/lawiki10/exportPortfolio?mode=teacher', 'tool/lawiki10/contribute.do', 'tool/lawiki10/moderate.do', +'tool/lawiki10/pedagogicalPlanner.do', 'http://wiki.lamsfoundation.org/display/lamsdocs/lawiki10', 'org.lamsfoundation.lams.tool.wiki.ApplicationResources', 'lams-tool-lawiki10.jar', Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/dbupdates/patch20090121_updateFrom22.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/dbupdates/patch20090121_updateFrom22.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/dbupdates/patch20090121_updateFrom22.sql 21 Jan 2009 22:17:04 -0000 1.1 @@ -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/lawiki10/pedagogicalPlanner.do' WHERE tool_signature='lawiki10'; + +----------------------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_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/PedagogicalPlannerAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/PedagogicalPlannerAction.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/PedagogicalPlannerAction.java 21 Jan 2009 22:17:04 -0000 1.1 @@ -0,0 +1,105 @@ +/**************************************************************** + * 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: PedagogicalPlannerAction.java,v 1.1 2009/01/21 22:17:04 marcin Exp $$ */ + +package org.lamsfoundation.lams.tool.wiki.web.actions; + +import java.io.IOException; + +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.action.ActionMessages; +import org.lamsfoundation.lams.tool.wiki.model.Wiki; +import org.lamsfoundation.lams.tool.wiki.model.WikiPage; +import org.lamsfoundation.lams.tool.wiki.service.IWikiService; +import org.lamsfoundation.lams.tool.wiki.service.WikiServiceProxy; +import org.lamsfoundation.lams.tool.wiki.web.forms.WikiPedagogicalPlannerForm; +import org.lamsfoundation.lams.util.FileUtil; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.action.LamsDispatchAction; +import org.lamsfoundation.lams.web.util.AttributeNames; + +/** + * @author Marcin Cieslak + * + * @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 IWikiService wikiService; + + @Override + protected ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + if (wikiService == null) { + wikiService = WikiServiceProxy.getWikiService(this.getServlet().getServletContext()); + } + return initPedagogicalPlannerForm(mapping, form, request, response); + } + + public ActionForward initPedagogicalPlannerForm(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + WikiPedagogicalPlannerForm plannerForm = (WikiPedagogicalPlannerForm) form; + Long toolContentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); + Wiki wiki = getWikiService().getWikiByContentId(toolContentID); + plannerForm.fillForm(wiki); + plannerForm.setContentFolderID(FileUtil.generateUniqueContentFolderID()); + return mapping.findForward("success"); + } + + public ActionForward saveOrUpdatePedagogicalPlannerForm(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws IOException { + WikiPedagogicalPlannerForm plannerForm = (WikiPedagogicalPlannerForm) form; + ActionMessages errors = plannerForm.validate(); + if (errors.isEmpty()) { + String instructions = plannerForm.getWikiBody(); + Long toolContentID = plannerForm.getToolContentID(); + Wiki wiki = getWikiService().getWikiByContentId(toolContentID); + WikiPage wikiPage = wiki.getWikiPages().iterator().next(); + wikiPage.setTitle(plannerForm.getTitle()); + wikiPage.getCurrentWikiContent().setBody(plannerForm.getWikiBody()); + getWikiService().saveOrUpdateWikiPage(wikiPage); + } else { + saveErrors(request, errors); + } + return mapping.findForward("success"); + } + + private IWikiService getWikiService() { + if (wikiService == null) { + wikiService = WikiServiceProxy.getWikiService(this.getServlet().getServletContext()); + } + return wikiService; + } + +} \ No newline at end of file Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/forms/WikiPedagogicalPlannerForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/forms/WikiPedagogicalPlannerForm.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/forms/WikiPedagogicalPlannerForm.java 21 Jan 2009 22:17:04 -0000 1.1 @@ -0,0 +1,86 @@ +/**************************************************************** + * 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: WikiPedagogicalPlannerForm.java,v 1.1 2009/01/21 22:17:04 marcin Exp $ */ +package org.lamsfoundation.lams.tool.wiki.web.forms; + +import org.apache.commons.lang.StringUtils; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; +import org.lamsfoundation.lams.tool.wiki.model.Wiki; +import org.lamsfoundation.lams.tool.wiki.model.WikiPage; +import org.lamsfoundation.lams.web.planner.PedagogicalPlannerForm; + +/** + * @struts.form name="pedagogicalPlannerForm" + */ +public class WikiPedagogicalPlannerForm extends PedagogicalPlannerForm { + String title; + String wikiBody; + String contentFolderID; + + public String getWikiBody() { + return wikiBody; + } + + public void setWikiBody(String body) { + this.wikiBody = body; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getContentFolderID() { + return contentFolderID; + } + + public void setContentFolderID(String contentFolderID) { + this.contentFolderID = contentFolderID; + } + + public void fillForm(Wiki wiki) { + if (wiki != null) { + WikiPage page = wiki.getWikiPages().iterator().next(); + setWikiBody(page.getCurrentWikiContent().getBody()); + setTitle(page.getTitle()); + setToolContentID(wiki.getToolContentId()); + } + } + + @Override + public ActionMessages validate() { + ActionMessages errors = new ActionMessages(); + boolean valid = true; + if (StringUtils.isEmpty(getTitle())) { + ActionMessage error = new ActionMessage("label.wiki.add.title.required"); + errors.add(ActionMessages.GLOBAL_MESSAGE, error); + valid = false; + } + setValid(valid); + return errors; + } +} \ No newline at end of file Index: lams_tool_wiki/web/pages/authoring/pedagogicalPlannerForm.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/web/pages/authoring/pedagogicalPlannerForm.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_wiki/web/pages/authoring/pedagogicalPlannerForm.jsp 21 Jan 2009 22:17:04 -0000 1.1 @@ -0,0 +1,49 @@ + + +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + +

+ +
+
+

+
+ + + + + + +

+ +

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