Index: lams_tool_wiki/web/pages/learning/wiki.jsp =================================================================== diff -u -r6c3d39685a1c47ef53b41a1eb29818b6f23f85cc -rf6959ef7792273a7ff3f05439513533678f9cc1f --- lams_tool_wiki/web/pages/learning/wiki.jsp (.../wiki.jsp) (revision 6c3d39685a1c47ef53b41a1eb29818b6f23f85cc) +++ lams_tool_wiki/web/pages/learning/wiki.jsp (.../wiki.jsp) (revision f6959ef7792273a7ff3f05439513533678f9cc1f) @@ -1,17 +1,12 @@ - <%@ include file="/common/taglibs.jsp"%> <%@ page import="org.lamsfoundation.lams.tool.wiki.util.WikiConstants"%> - - - - - - + + @@ -23,63 +18,64 @@ <script type="text/javascript" src="${tool}includes/javascript/wikiCommon.js"></script> <script type="text/javascript" src="${lams}includes/javascript/jquery.js"></script> <script type="text/javascript" src="${lams}includes/javascript/bootstrap.min.js"></script> + + <script language="JavaScript" type="text/javascript" src="<lams:LAMSURL/>includes/javascript/jquery.js"></script> + <script language="JavaScript" type="text/javascript" src="<lams:LAMSURL/>includes/javascript/jquery-ui.js"></script> + <script language="JavaScript" type="text/javascript" src="includes/javascript/validation.js"></script> + <script type="text/javascript" src="<lams:LAMSURL />/includes/javascript/jquery.timeago.js"></script> + <c:set var="localeLanguage"><lams:user property="localeLanguage" /></c:set> + <script type="text/javascript" src="<lams:LAMSURL />/includes/javascript/timeagoi18n/jquery.timeago.${fn:toLowerCase(localeLanguage)}.js"></script> + + <script type="text/javascript"> + <!-- + var mode = "${mode}"; + var formName = "learningForm" + + $(document).ready(function() { + $("time.timeago").timeago(); + }); + + function disableFinishButton() { + document.getElementById("finishButton").disabled = true; + } + + function validateForm() { + + // Validates that there's input from the user. + + // disables the Finish button to avoid double submission + disableFinishButton(); + + if (mode == "learner") { + // if this is learner mode, then we add this validation see (LDEV-1319) + + if (document.forms.learningForm.entryText.value == "") { + + // if the input is blank, then we further inquire to make sure it is correct + if (confirm("<fmt:message>message.learner.blank.input</fmt:message>")) { + // if correct, submit form + return true; + } else { + // otherwise, focus on the text area + document.forms.learningForm.entryText.focus(); + document.getElementById("finishButton").disabled = false; + return false; + } + } else { + // there was something on the form, so submit the form + return true; + } + } + } + + --> + </script> </lams:head> <body class="stripes"> - <script language="JavaScript" type="text/javascript" src="<lams:LAMSURL/>includes/javascript/jquery.js"></script> - <script language="JavaScript" type="text/javascript" src="<lams:LAMSURL/>includes/javascript/jquery-ui.js"></script> - <script language="JavaScript" type="text/javascript" src="includes/javascript/validation.js"></script> - <script type="text/javascript" src="<lams:LAMSURL />/includes/javascript/jquery.timeago.js"></script> - <c:set var="localeLanguage"><lams:user property="localeLanguage" /></c:set> - <script type="text/javascript" src="<lams:LAMSURL />/includes/javascript/timeagoi18n/jquery.timeago.${fn:toLowerCase(localeLanguage)}.js"></script> - - <script type="text/javascript"> - <!-- - var mode = "${mode}"; - var formName = "learningForm" - - $(document).ready(function() { - $("time.timeago").timeago(); - }); - - function disableFinishButton() { - document.getElementById("finishButton").disabled = true; - } - - function validateForm() { - - // Validates that there's input from the user. - - // disables the Finish button to avoid double submission - disableFinishButton(); - - if (mode == "learner") { - // if this is learner mode, then we add this validation see (LDEV-1319) - - if (document.learningForm.entryText.value == "") { - - // if the input is blank, then we further inquire to make sure it is correct - if (confirm("<fmt:message>message.learner.blank.input</fmt:message>")) { - // if correct, submit form - return true; - } else { - // otherwise, focus on the text area - document.learningForm.entryText.focus(); - document.getElementById("finishButton").disabled = false; - return false; - } - } else { - // there was something on the form, so submit the form - return true; - } - } - } - - --> - </script> - - <lams:Page type="learner" usePanel="false"formID="learningForm"> + + <lams:Page type="learner" usePanel="false" formID="learningForm"> <form:form action="learning.do" method="post" id="learningForm" modelAttribute="learningForm" enctype="multipart/form-data"> @@ -283,7 +279,7 @@ <form:hidden path="toolSessionID" id = "toolSessionID" /> <form:hidden path="mode" /> <input type="hidden" name="userID" value="${userDTO.userId}"/> - <form:hidden path="currentWikiPage" value="${currentWikiPage.uid}" id="currentWikiPage" /> + <input type="hidden" name="currentWikiPage" value="${currentWikiPage.uid}" id="currentWikiPage" /> <input type="hidden" id="wikiLinks" /> <form:hidden path="newPageName" id="newPageName" /> <form:hidden path="historyPageContentId" id="historyPageContentId" /> @@ -313,7 +309,7 @@ <fmt:message key="label.wiki.history.actions"></fmt:message> </th> </tr> - <c:forEach var="wikiContentPageVersion"items="${wikiPageContentHistory}"> + <c:forEach var="wikiContentPageVersion" items="${wikiPageContentHistory}"> <c:if test="${wikiContentPageVersion.version != currentWikiPage.currentWikiContentDTO.version}"> <tr> <td>${wikiContentPageVersion.version}</td> @@ -487,11 +483,11 @@ document.getElementById("wikiLinks").value = wikiLinkArray.toString(); } - function doEditOrAdd(dispatch) + function doEditOrAdd(actionMethod) { var title=""; - if(dispatch == "editPage") + if(actionMethod == "editPage") { title = document.getElementById("title").value; } @@ -510,7 +506,7 @@ for (i=0; i<wikiLinkArray.length; i++) { - if(dispatch == "editPage" && wikiLinkArray[i] == '${fn:escapeXml(currentWikiPage.javaScriptTitle)}') + if(actionMethod == "editPage" && wikiLinkArray[i] == '${fn:escapeXml(currentWikiPage.javaScriptTitle)}') { continue; } @@ -524,16 +520,16 @@ // if all validation fulfilled, we can continue document.getElementById("title").value = trim(title); - submitWiki(dispatch); + submitWiki(actionMethod); } - function submitWiki(dispatch) - { - document.getElementById("learningForm").action += "?dispatch=" + dispatch; - replaceJavascriptTokenAndSubmit("learningForm"); - } + function submitWiki(actionMethod) + { + document.forms.learningForm.action=actionMethod+".do"; + document.forms.learningForm.submit(); + replaceJavascriptTokenAndSubmit("learningForm"); + } - function hideToolbarItem(editorInstance, itemName) { editorInstance.ui.items[itemName].setState(CKEDITOR.TRISTATE_DISABLED); @@ -558,7 +554,7 @@ function refreshPage() { var toolSessionID = $("#toolSessionID").val(); - var url = "<lams:WebAppURL/>/learning.do?mode=${mode}&toolSessionID="+toolSessionID+"¤tWikiPageId=${currentWikiPage.uid}" + var url = "<lams:WebAppURL/>/learning/learning.do?mode=${mode}&toolSessionID="+toolSessionID+"¤tWikiPageId=${currentWikiPage.uid}" window.location=url; }