Skip to content

Commit 538c601

Browse files
Merge pull request #6518 from christianbeeznest/rna-22255-3
Catalog: Refactor and update catalog settings schema - refs BT#22255
2 parents 1f25b2a + fa08ce4 commit 538c601

29 files changed

+476
-324
lines changed

assets/vue/components/basecomponents/BaseSidebarPanelMenu.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ watch(
1414
() => modelValue.value,
1515
(val) => {
1616
expandedKeys.value = buildExpandedKeys(val || [])
17-
console.debug("[Sidebar] expandedKeys (from items):", expandedKeys.value)
1817
},
1918
{ immediate: true }
2019
)

assets/vue/components/course/CatalogueCourseCard.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ const showDescriptionDialog = ref(false)
229229
const showDependenciesModal = ref(false)
230230
231231
const allowDescription = computed(
232-
() => platformConfigStore.getSetting("course.show_courses_descriptions_in_catalog") !== "false",
232+
() => platformConfigStore.getSetting("catalog.show_courses_descriptions_in_catalog") !== "false",
233233
)
234234
235235
const durationInHours = computed(() => {
@@ -253,7 +253,7 @@ const subscribeToCourse = async () => {
253253
subscribing.value = true
254254
255255
const useAutoSession =
256-
platformConfigStore.getSetting("session.catalog_course_subscription_in_user_s_session") === "true"
256+
platformConfigStore.getSetting("catalog.course_subscription_in_user_s_session") === "true"
257257
258258
let sessionId = null
259259
@@ -300,7 +300,7 @@ function routeExists(name) {
300300
}
301301
302302
const linkSettings = computed(() => {
303-
const settings = platformConfigStore.getSetting("course.course_catalog_settings")
303+
const settings = platformConfigStore.getSetting("catalog.course_catalog_settings")
304304
return settings?.link_settings ?? {}
305305
})
306306

assets/vue/components/layout/TopbarNotLoggedIn.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ const menuItems = computed(() => {
6464
}
6565
6666
const showCatalogueLink =
67-
platformConfigStore.getSetting("course.course_catalog_published") !== "false" &&
68-
platformConfigStore.getSetting("course.catalog_hide_public_link") !== "true" &&
69-
platformConfigStore.getSetting("display.allow_students_to_browse_courses") !== "false"
67+
platformConfigStore.getSetting("catalog.course_catalog_published") !== "false" &&
68+
platformConfigStore.getSetting("catalog.hide_public_link") !== "true" &&
69+
platformConfigStore.getSetting("catalog.allow_students_to_browse_courses") !== "false"
7070
7171
if (showCatalogueLink) {
7272
items.splice(1, 0, {

assets/vue/components/session/CatalogueSessionCard.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ const fallback = ref(false)
248248
249249
const platformConfigStore = usePlatformConfig()
250250
const allowDescription = computed(
251-
() => platformConfigStore.getSetting("course.show_courses_descriptions_in_catalog") !== "false",
251+
() => platformConfigStore.getSetting("catalog.show_courses_descriptions_in_catalog") !== "false",
252252
)
253253
const { getOriginalLanguageName } = useLocale()
254254
@@ -348,7 +348,7 @@ const emitRating = (event) => {
348348
}
349349
350350
const allowAutoSubscription = computed(
351-
() => platformConfigStore.getSetting("session.catalog_allow_session_auto_subscription") === "true",
351+
() => platformConfigStore.getSetting("catalog.allow_session_auto_subscription") === "true",
352352
)
353353
354354
const subscribeToSession = async () => {

assets/vue/composables/sidebarMenu.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,37 +35,32 @@ export function useSidebarMenu() {
3535
}
3636

3737
const roles = securityStore.user?.roles || []
38-
console.debug("[Sidebar] User roles:", roles)
39-
console.debug("[Sidebar] tabsPerRole:", tabsPerRole)
40-
4138
for (const role of roles) {
4239
const mappedRole = roleMap[role] || role
4340
if (tabsPerRole[mappedRole]) {
44-
console.debug("[Sidebar] Matched role:", mappedRole, "tabs:", tabsPerRole[mappedRole])
4541
return tabsPerRole[mappedRole]
4642
}
4743
}
4844

49-
console.debug("[Sidebar] No matched role, using defaultTabs:", defaultTabs)
5045
return defaultTabs
5146
})
5247

53-
const rawShowCatalogue = platformConfigStore.getSetting("platform.catalog_show_courses_sessions")
48+
const rawShowCatalogue = platformConfigStore.getSetting("catalog.show_courses_sessions")
5449
const showCatalogue = Number(rawShowCatalogue)
5550
const isAnonymous = !securityStore.isAuthenticated
5651
const isPrivilegedUser =
5752
securityStore.isAdmin || securityStore.isTeacher || securityStore.isHRM || securityStore.isSessionAdmin
5853
const allowStudentCatalogue = computed(() => {
5954
if (isAnonymous) {
60-
return platformConfigStore.getSetting("course.course_catalog_published") !== "false"
55+
return platformConfigStore.getSetting("catalog.course_catalog_published") !== "false"
6156
}
6257

6358
if (isPrivilegedUser) {
6459
return true
6560
}
6661

6762
if (securityStore.isStudent) {
68-
return platformConfigStore.getSetting("display.allow_students_to_browse_courses") !== "false"
63+
return platformConfigStore.getSetting("catalog.allow_students_to_browse_courses") !== "false"
6964
}
7065

7166
return false

assets/vue/pages/Home.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ if (typeof redirectValue === "string" && redirectValue.trim() !== "") {
5757
router.replace(`/${redirectValue}`)
5858
}
5959
60-
const showCatalogue = computed(() => platformConfigStore.getSetting("course.course_catalog_display_in_home") === "true")
60+
const showCatalogue = computed(() => platformConfigStore.getSetting("catalog.course_catalog_display_in_home") === "true")
6161
const allCourses = ref([])
6262
const visibleCourses = ref([])
6363
const pageSize = 8

assets/vue/views/course/CatalogueCourses.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ const securityStore = useSecurityStore()
214214
215215
const platformConfigStore = usePlatformConfig()
216216
const courseCatalogueSettings = computed(() => {
217-
let raw = platformConfigStore.getSetting("course.course_catalog_settings")
217+
let raw = platformConfigStore.getSetting("catalog.course_catalog_settings")
218218
if (!raw || raw === false || raw === "false") return {}
219219
try {
220220
if (typeof raw === "string") {
@@ -301,15 +301,15 @@ const isPrivilegedUser =
301301
302302
const allowCatalogueAccess = computed(() => {
303303
if (isAnonymous) {
304-
return platformConfigStore.getSetting("course.course_catalog_published") !== "false"
304+
return platformConfigStore.getSetting("catalog.course_catalog_published") !== "false"
305305
}
306306
307307
if (isPrivilegedUser) {
308308
return true
309309
}
310310
311311
if (securityStore.isStudent) {
312-
return platformConfigStore.getSetting("display.allow_students_to_browse_courses") !== "false"
312+
return platformConfigStore.getSetting("catalog.allow_students_to_browse_courses") !== "false"
313313
}
314314
315315
return false
@@ -391,7 +391,7 @@ const clearFilter = () => {
391391
392392
const filteredCourses = ref([])
393393
const visibleCoursesBase = computed(() => {
394-
const hidePrivate = platformConfigStore.getSetting("platform.course_catalog_hide_private") === "true"
394+
const hidePrivate = platformConfigStore.getSetting("catalog.course_catalog_hide_private") === "true"
395395
const sortOpt = allSortOptions.value.find((opt) => opt.value === sortField.value)
396396
397397
let list = filteredCourses.value.filter((course) => {

assets/vue/views/course/CatalogueSessions.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const loadingMore = ref(false)
9898
const platformConfigStore = usePlatformConfig()
9999
100100
const sessionCatalogSettings = computed(() => {
101-
const settings = platformConfigStore.getSetting("session.catalog_settings") || {}
101+
const settings = platformConfigStore.getSetting("catalog.session_catalog_settings") || {}
102102
return settings.sessions || {}
103103
})
104104

public/main/auth/courses.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
// Section for the tabs.
1818
$this_section = SECTION_CATALOG;
1919

20-
if ('true' !== api_get_setting('course_catalog_published')) {
20+
if ('true' !== api_get_setting('catalog.course_catalog_published')) {
2121
// Access rights: anonymous users can't do anything useful here.
2222
api_block_anonymous_users();
2323
}
2424

25-
$allowExtraFields = ('true' === api_get_setting('course.allow_course_extra_field_in_catalog'));
25+
$allowExtraFields = !empty(api_get_setting('catalog.course_catalog_settings'));
2626

2727
// For students
2828
$userCanViewPage = true;
29-
if ('false' === api_get_setting('allow_students_to_browse_courses')) {
29+
if ('false' === api_get_setting('catalog.allow_students_to_browse_courses')) {
3030
$userCanViewPage = false;
3131
}
3232

@@ -69,7 +69,7 @@
6969
];
7070

7171
$redirectAfterSubscription = 'course_home';
72-
$settings = api_get_setting('course.course_catalog_settings', true);
72+
$settings = api_get_setting('catalog.course_catalog_settings', true);
7373
// By default all extra fields are shown (visible and filterable)
7474
$extraFieldsInSearchForm = [];
7575
$extraFieldsInCourseBlock = [];
@@ -116,7 +116,7 @@
116116
CourseManager::autoSubscribeToCourse($courseCodeToSubscribe);
117117
if ('course_home' === $redirectAfterSubscription) {
118118
$redirectionTarget = $courseInfo['course_public_url'];
119-
if ('true' === api_get_setting('session.catalog_course_subscription_in_user_s_session')) {
119+
if ('true' === api_get_setting('catalog.course_subscription_in_user_s_session')) {
120120
$user = api_get_user_entity(api_get_user_id());
121121
if ($user) {
122122
foreach ($user->getCurrentlyAccessibleSessions() as $session) {
@@ -164,7 +164,7 @@
164164

165165
if ('course_home' === $redirectAfterSubscription) {
166166
$redirectionTarget = $courseInfo['course_public_url'];
167-
if ('true' === api_get_setting('session.catalog_course_subscription_in_user_s_session')) {
167+
if ('true' === api_get_setting('catalog.course_subscription_in_user_s_session')) {
168168
$user = api_get_user_entity(api_get_user_id());
169169
if ($user) {
170170
foreach ($user->getCurrentlyAccessibleSessions() as $session) {
@@ -318,7 +318,7 @@
318318
}
319319

320320
$catalogShowCoursesSessions = 0;
321-
$showCoursesSessions = (int) api_get_setting('catalog_show_courses_sessions');
321+
$showCoursesSessions = (int) api_get_setting('catalog.show_courses_sessions');
322322
if ($showCoursesSessions > 0) {
323323
$catalogShowCoursesSessions = $showCoursesSessions;
324324
}
@@ -610,7 +610,7 @@
610610
exit;
611611
}
612612

613-
$registrationAllowed = api_get_setting('catalog_allow_session_auto_subscription');
613+
$registrationAllowed = api_get_setting('catalog.allow_session_auto_subscription');
614614
if ('true' === $registrationAllowed) {
615615
$entityManager = Database::getManager();
616616
$repository = $entityManager->getRepository(SequenceResource::class);

public/main/auth/registration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ function ($email) {
10221022
).'</a>';
10231023
}
10241024
} else {
1025-
if ('true' == api_get_setting('allow_students_to_browse_courses')) {
1025+
if ('true' == api_get_setting('catalog.allow_students_to_browse_courses')) {
10261026
$formData['action'] = 'courses.php?action=subscribe';
10271027
$formData['message'] = '<p>'.get_lang('You can now select, in the list, the course you want access to').".</p>";
10281028
} else {

0 commit comments

Comments
 (0)