Skip to content

Commit 96cf80b

Browse files
Merge pull request #8477 from christianbeeznest/fixes-plugin-dictionary01
Plugin: Improve Dictionary plugin integration
2 parents 76206b1 + ad761d4 commit 96cf80b

15 files changed

Lines changed: 793 additions & 165 deletions

File tree

assets/vue/composables/sidebarMenu.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@ export function useSidebarMenu() {
226226
securityStore.isAdmin || securityStore.isTeacher || securityStore.isHRM || securityStore.isSessionAdmin
227227

228228
const buyCoursesConfig = computed(() => platformConfigStore.plugins?.buycourses || {})
229+
const searchCourseConfig = computed(() => platformConfigStore.plugins?.searchcourse || {})
230+
const rssConfig = computed(() => platformConfigStore.plugins?.rss || {})
231+
const dictionaryConfig = computed(() => platformConfigStore.plugins?.dictionary || {})
229232

230233
const showBuyCoursesMenuItem = computed(() => {
231234
if (!securityStore.isAuthenticated) {
@@ -239,6 +242,54 @@ export function useSidebarMenu() {
239242
return buyCoursesConfig.value?.indexPath || "/plugin/BuyCourses/index.php"
240243
})
241244

245+
const showSearchCourseMenuItem = computed(() => {
246+
if (!securityStore.isAuthenticated) {
247+
return false
248+
}
249+
250+
return normalizeBooleanFlag(searchCourseConfig.value?.enabled)
251+
})
252+
253+
const searchCourseIndexPath = computed(() => {
254+
return searchCourseConfig.value?.indexPath || "/plugin/SearchCourse/index.php"
255+
})
256+
257+
const searchCourseMenuTitle = computed(() => {
258+
return searchCourseConfig.value?.title || t("Search courses")
259+
})
260+
261+
const showRssMenuItem = computed(() => {
262+
if (!securityStore.isAuthenticated) {
263+
return false
264+
}
265+
266+
return normalizeBooleanFlag(rssConfig.value?.enabled)
267+
})
268+
269+
const rssIndexPath = computed(() => {
270+
return rssConfig.value?.indexPath || "/plugin/Rss/index.php"
271+
})
272+
273+
const rssMenuTitle = computed(() => {
274+
return rssConfig.value?.title || t("RSS feed")
275+
})
276+
277+
const showDictionaryMenuItem = computed(() => {
278+
if (!securityStore.isAuthenticated) {
279+
return false
280+
}
281+
282+
return normalizeBooleanFlag(dictionaryConfig.value?.enabled)
283+
})
284+
285+
const dictionaryIndexPath = computed(() => {
286+
return dictionaryConfig.value?.indexPath || "/plugin/Dictionary/index.php"
287+
})
288+
289+
const dictionaryMenuTitle = computed(() => {
290+
return dictionaryConfig.value?.title || t("Dictionary")
291+
})
292+
242293
const allowStudentCatalogue = computed(() => {
243294
if (isAnonymous) {
244295
return platformConfigStore.getSetting("catalog.course_catalog_published") !== "false"
@@ -348,6 +399,30 @@ export function useSidebarMenu() {
348399
})
349400
}
350401

402+
if (showSearchCourseMenuItem.value) {
403+
items.push({
404+
icon: "mdi mdi-book-search-outline",
405+
label: searchCourseMenuTitle.value,
406+
url: searchCourseIndexPath.value,
407+
})
408+
}
409+
410+
if (showDictionaryMenuItem.value) {
411+
items.push({
412+
icon: "mdi mdi-book-open-page-variant-outline",
413+
label: dictionaryMenuTitle.value,
414+
url: dictionaryIndexPath.value,
415+
})
416+
}
417+
418+
if (showRssMenuItem.value) {
419+
items.push({
420+
icon: "mdi mdi-rss",
421+
label: rssMenuTitle.value,
422+
url: rssIndexPath.value,
423+
})
424+
}
425+
351426
items.push(createMenuItem("my_agenda", "mdi-calendar-text", "Agenda", "CCalendarEventList"))
352427

353428
if (allowSearchFeature.value && isMenuTabEnabled("search")) {

public/main/admin/settings.lib.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ function getStablePluginAllowList(): array
335335
'EmbedRegistry',
336336
'SearchCourse',
337337
'Rss',
338+
'Dictionary',
338339
];
339340
}
340341

0 commit comments

Comments
 (0)