From 84e41a3e779ea006d9cac285baf3c86935d085ab Mon Sep 17 00:00:00 2001 From: srosse <none@none> Date: Tue, 12 Jan 2016 12:17:28 +0100 Subject: [PATCH] OO-1833: try to convert some old repo/go urls to business path --- .../olat/course/run/RunMainController.java | 2 +- .../dispatcher/AuthenticatedDispatcher.java | 27 +++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/olat/course/run/RunMainController.java b/src/main/java/org/olat/course/run/RunMainController.java index ae018953271..7f1b9f3c617 100644 --- a/src/main/java/org/olat/course/run/RunMainController.java +++ b/src/main/java/org/olat/course/run/RunMainController.java @@ -803,7 +803,7 @@ public class RunMainController extends MainLayoutBasicController implements Gene ContextEntry firstEntry = entries.get(0); String type = firstEntry.getOLATResourceable().getResourceableTypeName(); - if("CourseNode".equalsIgnoreCase(type)) { + if("CourseNode".equalsIgnoreCase(type) || "Part".equalsIgnoreCase(type)) { CourseNode cn = course.getRunStructure().getNode(firstEntry.getOLATResourceable().getResourceableId().toString()); if(currentCourseNode == null || !currentCourseNode.equals(cn)) { getWindowControl().makeFlat(); diff --git a/src/main/java/org/olat/dispatcher/AuthenticatedDispatcher.java b/src/main/java/org/olat/dispatcher/AuthenticatedDispatcher.java index 01504f82e2c..c20801732bb 100644 --- a/src/main/java/org/olat/dispatcher/AuthenticatedDispatcher.java +++ b/src/main/java/org/olat/dispatcher/AuthenticatedDispatcher.java @@ -215,7 +215,6 @@ public class AuthenticatedDispatcher implements Dispatcher { // valid uri for dispatching (has timestamp, componentid and windowid) processValidDispatchURI(ureq, usess, request, response); } else { - final String origUri = request.getRequestURI(); String restPart = origUri.substring(uriPrefix.length()); try { @@ -225,7 +224,10 @@ public class AuthenticatedDispatcher implements Dispatcher { } String[] split = restPart.split("/"); - if (split.length > 0 && split.length % 2 == 0) { + if(restPart.startsWith("repo/go")) { + businessPath = convertJumpInURL(restPart, ureq); + processBusinessPath(businessPath, ureq, usess); + } else if (split.length > 0 && split.length % 2 == 0) { businessPath = BusinessControlFactory.getInstance().formatFromURI(restPart); processBusinessPath(businessPath, ureq, usess); } else { @@ -257,6 +259,27 @@ public class AuthenticatedDispatcher implements Dispatcher { } } + /** + * http://localhost:8080/olat/auth/repo/go?rid=819242&par=77013818723561 + * @param requestPart + * @param ureq + * @return + */ + private String convertJumpInURL(String requestPart, UserRequest ureq) { + String repoId = ureq.getParameter("rid"); + String businessPath = "[RepositoryEntry:" + repoId + "]"; + String par = ureq.getParameter("par"); + if(StringHelper.containsNonWhitespace(par) && StringHelper.isLong(par)) { + try { + Long parLong = Long.parseLong(par); + businessPath += "[Part:" + parLong + "]"; + } catch(NumberFormatException e) { + //it can happen + } + } + return businessPath; + } + private void processValidDispatchURI(UserRequest ureq, UserSession usess, HttpServletRequest request, HttpServletResponse response) { Windows ws = Windows.getWindows(ureq); Window window = ws.getWindow(ureq); -- GitLab