Index: lams_build/lib/pedagogical_planner/1/1/1/LAMS_Pedagogical_Planner_Template.zip
===================================================================
diff -u -r3fe05cc69b1d0cfa2cb494a4778a8ab00dec2d60 -r8d32e52903d230f8018ac609041934db7f180e73
Binary files differ
Index: lams_central/web/includes/javascript/pedagogicalPlanner.js
===================================================================
diff -u -re456cbdff56a950306015c2e58a9c0460cba7888 -r8d32e52903d230f8018ac609041934db7f180e73
--- lams_central/web/includes/javascript/pedagogicalPlanner.js (.../pedagogicalPlanner.js) (revision e456cbdff56a950306015c2e58a9c0460cba7888)
+++ lams_central/web/includes/javascript/pedagogicalPlanner.js (.../pedagogicalPlanner.js) (revision 8d32e52903d230f8018ac609041934db7f180e73)
@@ -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
===================================================================
diff -u -r406cdd685f03fa39a0ea0c85bde60f7b268bc05d -r8d32e52903d230f8018ac609041934db7f180e73
--- lams_tool_wiki/.classpath (.../.classpath) (revision 406cdd685f03fa39a0ea0c85bde60f7b268bc05d)
+++ lams_tool_wiki/.classpath (.../.classpath) (revision 8d32e52903d230f8018ac609041934db7f180e73)
@@ -9,5 +9,7 @@
+
+
Index: lams_tool_wiki/build.properties
===================================================================
diff -u -r1082bdcc357c105126a5641cecc68acfa645b66b -r8d32e52903d230f8018ac609041934db7f180e73
--- lams_tool_wiki/build.properties (.../build.properties) (revision 1082bdcc357c105126a5641cecc68acfa645b66b)
+++ lams_tool_wiki/build.properties (.../build.properties) (revision 8d32e52903d230f8018ac609041934db7f180e73)
@@ -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
===================================================================
diff -u -r17690c3ef82e9cba26cc0cd656b40d212871ba07 -r8d32e52903d230f8018ac609041934db7f180e73
--- lams_tool_wiki/db/sql/tool_insert.sql (.../tool_insert.sql) (revision 17690c3ef82e9cba26cc0cd656b40d212871ba07)
+++ lams_tool_wiki/db/sql/tool_insert.sql (.../tool_insert.sql) (revision 8d32e52903d230f8018ac609041934db7f180e73)
@@ -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
===================================================================
diff -u
--- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/dbupdates/patch20090121_updateFrom22.sql (revision 0)
+++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/dbupdates/patch20090121_updateFrom22.sql (revision 8d32e52903d230f8018ac609041934db7f180e73)
@@ -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
===================================================================
diff -u
--- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/PedagogicalPlannerAction.java (revision 0)
+++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/PedagogicalPlannerAction.java (revision 8d32e52903d230f8018ac609041934db7f180e73)
@@ -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$$ */
+
+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
===================================================================
diff -u
--- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/forms/WikiPedagogicalPlannerForm.java (revision 0)
+++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/forms/WikiPedagogicalPlannerForm.java (revision 8d32e52903d230f8018ac609041934db7f180e73)
@@ -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$ */
+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
===================================================================
diff -u
--- lams_tool_wiki/web/pages/authoring/pedagogicalPlannerForm.jsp (revision 0)
+++ lams_tool_wiki/web/pages/authoring/pedagogicalPlannerForm.jsp (revision 8d32e52903d230f8018ac609041934db7f180e73)
@@ -0,0 +1,49 @@
+
+
+<%@ include file="/common/taglibs.jsp"%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file