|
|
|
@ -133,27 +133,29 @@ const router = createRouter({ |
|
|
|
|
const documentAutoLaunch = parseInt(courseSettingsStore.getSetting("enable_document_auto_launch"), 10) || 0 |
|
|
|
|
if (documentAutoLaunch === 1 && course.resourceNode?.id) { |
|
|
|
|
sessionStorage.setItem(autoLaunchKey, "true") |
|
|
|
|
window.location.href = `/resources/document/${course.resourceNode.id}/?cid=${courseId}` |
|
|
|
|
+ (sessionId ? `&sid=${sessionId}` : '') |
|
|
|
|
window.location.href = |
|
|
|
|
`/resources/document/${course.resourceNode.id}/?cid=${courseId}` + (sessionId ? `&sid=${sessionId}` : "") |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Exercise auto-launch
|
|
|
|
|
const platformConfigStore = usePlatformConfig() |
|
|
|
|
const isExerciseAutoLaunchEnabled = "true" === platformConfigStore.getSetting("exercise.allow_exercise_auto_launch") |
|
|
|
|
const isExerciseAutoLaunchEnabled = |
|
|
|
|
"true" === platformConfigStore.getSetting("exercise.allow_exercise_auto_launch") |
|
|
|
|
if (isExerciseAutoLaunchEnabled) { |
|
|
|
|
const exerciseAutoLaunch = parseInt(courseSettingsStore.getSetting("enable_exercise_auto_launch"), 10) || 0 |
|
|
|
|
if (exerciseAutoLaunch === 2) { |
|
|
|
|
sessionStorage.setItem(autoLaunchKey, "true") |
|
|
|
|
window.location.href = `/main/exercise/exercise.php?cid=${courseId}` |
|
|
|
|
+ (sessionId ? `&sid=${sessionId}` : '') |
|
|
|
|
window.location.href = |
|
|
|
|
`/main/exercise/exercise.php?cid=${courseId}` + (sessionId ? `&sid=${sessionId}` : "") |
|
|
|
|
return false |
|
|
|
|
} else if (exerciseAutoLaunch === 1) { |
|
|
|
|
const exerciseId = await courseService.getAutoLaunchExerciseId(courseId, sessionId) |
|
|
|
|
if (exerciseId) { |
|
|
|
|
sessionStorage.setItem(autoLaunchKey, "true") |
|
|
|
|
window.location.href = `/main/exercise/overview.php?exerciseId=${exerciseId}&cid=${courseId}` |
|
|
|
|
+ (sessionId ? `&sid=${sessionId}` : '') |
|
|
|
|
window.location.href = |
|
|
|
|
`/main/exercise/overview.php?exerciseId=${exerciseId}&cid=${courseId}` + |
|
|
|
|
(sessionId ? `&sid=${sessionId}` : "") |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -163,15 +165,15 @@ const router = createRouter({ |
|
|
|
|
const lpAutoLaunch = parseInt(courseSettingsStore.getSetting("enable_lp_auto_launch"), 10) || 0 |
|
|
|
|
if (lpAutoLaunch === 2) { |
|
|
|
|
sessionStorage.setItem(autoLaunchKey, "true") |
|
|
|
|
window.location.href = `/main/lp/lp_controller.php?cid=${courseId}` |
|
|
|
|
+ (sessionId ? `&sid=${sessionId}` : '') |
|
|
|
|
window.location.href = `/main/lp/lp_controller.php?cid=${courseId}` + (sessionId ? `&sid=${sessionId}` : "") |
|
|
|
|
return false |
|
|
|
|
} else if (lpAutoLaunch === 1) { |
|
|
|
|
const lpId = await courseService.getAutoLaunchLPId(courseId, sessionId) |
|
|
|
|
if (lpId) { |
|
|
|
|
sessionStorage.setItem(autoLaunchKey, "true") |
|
|
|
|
window.location.href = `/main/lp/lp_controller.php?lp_id=${lpId}&cid=${courseId}&action=view&isStudentView=true` |
|
|
|
|
+ (sessionId ? `&sid=${sessionId}` : '') |
|
|
|
|
window.location.href = |
|
|
|
|
`/main/lp/lp_controller.php?lp_id=${lpId}&cid=${courseId}&action=view&isStudentView=true` + |
|
|
|
|
(sessionId ? `&sid=${sessionId}` : "") |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -180,11 +182,9 @@ const router = createRouter({ |
|
|
|
|
const forumAutoLaunch = parseInt(courseSettingsStore.getSetting("enable_forum_auto_launch"), 10) || 0 |
|
|
|
|
if (forumAutoLaunch === 1) { |
|
|
|
|
sessionStorage.setItem(autoLaunchKey, "true") |
|
|
|
|
window.location.href = `/main/forum/index.php?cid=${courseId}` |
|
|
|
|
+ (sessionId ? `&sid=${sessionId}` : '') |
|
|
|
|
window.location.href = `/main/forum/index.php?cid=${courseId}` + (sessionId ? `&sid=${sessionId}` : "") |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
|
console.error("Error during CourseHome route guard:", error) |
|
|
|
|
} |
|
|
|
@ -269,7 +269,7 @@ router.beforeEach(async (to, from, next) => { |
|
|
|
|
|
|
|
|
|
if (!cid) { |
|
|
|
|
for (const key in sessionStorage) { |
|
|
|
|
if (key.startsWith('course_autolaunch_')) { |
|
|
|
|
if (key.startsWith("course_autolaunch_")) { |
|
|
|
|
sessionStorage.removeItem(key) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|