diff --git a/calendar/src/App.vue b/calendar/src/App.vue
new file mode 100644
index 0000000..8fbdf90
--- /dev/null
+++ b/calendar/src/App.vue
@@ -0,0 +1,24 @@
+
+
+
+
+
diff --git a/calendar/src/dashboard.js b/calendar/src/dashboard.js
new file mode 100644
index 0000000..ab83952
--- /dev/null
+++ b/calendar/src/dashboard.js
@@ -0,0 +1,50 @@
+/**
+ * @copyright Copyright (c) 2020 Julius Härtl
+ *
+ * @author Julius Härtl
+ *
+ * @license AGPL-3.0-or-later
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+import { generateFilePath } from '@nextcloud/router'
+import { getRequestToken } from '@nextcloud/auth'
+
+// eslint-disable-next-line
+__webpack_nonce__ = btoa(getRequestToken())
+
+// eslint-disable-next-line
+__webpack_public_path__ = generateFilePath('calendar', '', 'js/')
+
+document.addEventListener('DOMContentLoaded', function() {
+ OCA.Dashboard.register('calendar', async (el) => {
+ const { default: Vue } = await import(/* webpackChunkName: "dashboard-lazy" */'vue')
+ const { translate, translatePlural } = await import(/* webpackChunkName: "dashboard-lazy" */'@nextcloud/l10n')
+ const { default: Dashboard } = await import(/* webpackChunkName: "dashboard-lazy" */'./views/Dashboard.vue')
+ const { default: store } = await import(/* webpackChunkName: "dashboard-lazy" */'./store/index.js')
+
+ Vue.prototype.t = translate
+ Vue.prototype.n = translatePlural
+ Vue.prototype.OC = OC
+ Vue.prototype.OCA = OCA
+
+ const View = Vue.extend(Dashboard)
+ new View({
+ store,
+ propsData: {},
+ }).$mount(el)
+ })
+})
diff --git a/calendar/src/main.js b/calendar/src/main.js
new file mode 100644
index 0000000..50e5046
--- /dev/null
+++ b/calendar/src/main.js
@@ -0,0 +1,86 @@
+/**
+ * @copyright Copyright (c) 2019 Georg Ehrke
+ *
+ * @copyright Copyright (c) 2019 John Molakvoæ
+ *
+ * @author Georg Ehrke
+ *
+ * @author John Molakvoæ
+ *
+ * @license AGPL-3.0-or-later
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+import 'core-js/stable/index.js'
+
+import '../css/calendar.scss'
+
+import Vue from 'vue'
+import App from './App.vue'
+import router from './router.js'
+import store from './store/index.js'
+import { sync } from 'vuex-router-sync'
+import { getRequestToken } from '@nextcloud/auth'
+import { linkTo } from '@nextcloud/router'
+import { loadState } from '@nextcloud/initial-state'
+import { translate, translatePlural } from '@nextcloud/l10n'
+import AppointmentConfig from './models/appointmentConfig.js'
+import ClickOutside from 'vue-click-outside'
+import VTooltip from 'v-tooltip'
+import VueShortKey from 'vue-shortkey'
+import windowTitleService from './services/windowTitleService.js'
+import { createPinia, PiniaVuePlugin } from 'pinia'
+import useAppointmentConfigsStore from './store/appointmentConfigs.js'
+
+Vue.use(PiniaVuePlugin)
+const pinia = createPinia()
+
+// register global components
+Vue.directive('ClickOutside', ClickOutside)
+Vue.use(VTooltip)
+Vue.use(VueShortKey, { prevent: ['input', 'textarea'] })
+
+// CSP config for webpack dynamic chunk loading
+// eslint-disable-next-line
+__webpack_nonce__ = btoa(getRequestToken())
+
+// Correct the root of the app for chunk loading
+// OC.linkTo matches the apps folders
+// OC.generateUrl ensure the index.php (or not)
+// We do not want the index.php since we're loading files
+// eslint-disable-next-line
+__webpack_public_path__ = linkTo('calendar', 'js/')
+
+sync(store, router)
+
+Vue.prototype.$t = translate
+Vue.prototype.$n = translatePlural
+
+// The nextcloud-vue package does currently rely on t and n
+Vue.prototype.t = translate
+Vue.prototype.n = translatePlural
+
+windowTitleService(router, store)
+
+export default new Vue({
+ el: '#content',
+ router,
+ store,
+ render: h => h(App),
+ pinia,
+})
+
+const appointmentsConfigsStore = useAppointmentConfigsStore()
+appointmentsConfigsStore.addInitialConfigs(loadState('calendar', 'appointmentConfigs', []).map(config => new AppointmentConfig(config)))
diff --git a/calendar/src/reference.js b/calendar/src/reference.js
new file mode 100644
index 0000000..ce84ccb
--- /dev/null
+++ b/calendar/src/reference.js
@@ -0,0 +1,29 @@
+import { registerWidget, NcCustomPickerRenderResult } from '@nextcloud/vue/dist/Functions/registerReference.js'
+import { linkTo } from '@nextcloud/router'
+import { getRequestToken } from '@nextcloud/auth'
+import { translate, translatePlural } from '@nextcloud/l10n'
+import '../css/calendar.scss'
+
+__webpack_nonce__ = btoa(getRequestToken()) // eslint-disable-line
+__webpack_public_path__ = linkTo('calendar', 'js/') // eslint-disable-line
+
+registerWidget('calendar_widget', async (el, { richObjectType, richObject, accessible, interactive }) => {
+ const { default: Vue } = await import('vue')
+ const { default: Calendar } = await import('./views/Calendar.vue')
+ const { default: store } = await import('./store/index.js')
+ Vue.prototype.$t = translate
+ Vue.prototype.$n = translatePlural
+ Vue.mixin({ methods: { t, n } })
+
+ const Widget = Vue.extend(Calendar)
+ const vueElement = new Widget({
+ store,
+ propsData: {
+ isWidget: true,
+ referenceToken: richObject.token,
+ },
+ }).$mount(el)
+ return new NcCustomPickerRenderResult(vueElement.$el, vueElement)
+}, (el, renderResult) => {
+ renderResult.object.$destroy()
+}, true)
diff --git a/calendar/src/router.js b/calendar/src/router.js
new file mode 100644
index 0000000..06c62be
--- /dev/null
+++ b/calendar/src/router.js
@@ -0,0 +1,156 @@
+/**
+ * @copyright Copyright (c) 2019 Georg Ehrke
+ *
+ * @author Georg Ehrke
+ *
+ * @license AGPL-3.0-or-later
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+import Vue from 'vue'
+import Router from 'vue-router'
+import { getRootUrl, generateUrl } from '@nextcloud/router'
+
+import Calendar from './views/Calendar.vue'
+import EditSimple from './views/EditSimple.vue'
+import EditSidebar from './views/EditSidebar.vue'
+import {
+ getDefaultEndDateForNewEvent,
+ getDefaultStartDateForNewEvent,
+ getInitialView,
+ getPreferredEditorRoute,
+} from './utils/router.js'
+
+Vue.use(Router)
+
+const webRootWithIndexPHP = getRootUrl() + '/index.php'
+const doesURLContainIndexPHP = window.location.pathname.startsWith(webRootWithIndexPHP)
+const base = generateUrl('apps/calendar', {}, {
+ noRewrite: doesURLContainIndexPHP,
+})
+
+const router = new Router({
+ mode: 'history',
+ base,
+ routes: [
+ {
+ path: '/p/:tokens/:view/:firstDay',
+ component: Calendar,
+ name: 'PublicCalendarView',
+ children: [
+ {
+ path: '/p/:tokens/:view/:firstDay/view/popover/:object/:recurrenceId',
+ name: 'PublicEditPopoverView',
+ component: EditSimple,
+ },
+ {
+ path: '/p/:tokens/:view/:firstDay/view/sidebar/:object/:recurrenceId',
+ name: 'PublicEditSidebarView',
+ component: EditSidebar,
+ },
+ ],
+ },
+ {
+ path: '/embed/:tokens/:view/:firstDay',
+ component: Calendar,
+ name: 'EmbedCalendarView',
+ children: [
+ {
+ path: '/embed/:tokens/:view/:firstDay/view/popover/:object/:recurrenceId',
+ name: 'EmbedEditPopoverView',
+ component: EditSimple,
+ },
+ {
+ path: '/embed/:tokens/:view/:firstDay/view/sidebar/:object/:recurrenceId',
+ name: 'EmbedEditSidebarView',
+ component: EditSidebar,
+ },
+ ],
+ },
+ /**
+ * This route is the root-view that does not contain any parameters so far.
+ * Users usually access it by clicking the calendar-icon in the navigation bar.
+ *
+ * It automatically redirects you to the calendar view, showing the current month
+ * in the user's preferred view.
+ */
+ {
+ path: '/',
+ redirect: `/${getInitialView()}/now`,
+ },
+ {
+ path: '/p/:tokens/:fancyName?',
+ redirect: `/p/:tokens/${getInitialView()}/now`,
+ },
+ {
+ path: '/public/:tokens/:fancyName?',
+ redirect: `/p/:tokens/${getInitialView()}/now`,
+ },
+ {
+ path: '/embed/:tokens',
+ redirect: `/embed/:tokens/${getInitialView()}/now`,
+ },
+ {
+ path: '/new/:view?',
+ redirect: (to) => `/${to.params.view ?? getInitialView()}/now/new/${getPreferredEditorRoute()}/0/${getDefaultStartDateForNewEvent()}/${getDefaultEndDateForNewEvent()}`,
+ },
+ {
+ path: '/new/:allDay/:dtstart/:dtend',
+ redirect: () => `/${getInitialView()}/:dtstart/new/${getPreferredEditorRoute()}/:allDay/:dtstart/:dtend`,
+ },
+ {
+ path: '/edit/:object',
+ redirect: () => `/${getInitialView()}/now/edit/${getPreferredEditorRoute()}/:object/next`,
+ },
+ {
+ path: '/edit/:object/:recurrenceId',
+ redirect: () => `/${getInitialView()}/now/edit/${getPreferredEditorRoute()}/:object/:recurrenceId`,
+ },
+ /**
+ * This is the main route that contains the current view and viewed day
+ * It has to be last, so that other routes starting with /p/, etc. match first
+ */
+ {
+ path: '/:view/:firstDay',
+ component: Calendar,
+ name: 'CalendarView',
+ children: [
+ {
+ path: '/:view/:firstDay/edit/popover/:object/:recurrenceId',
+ name: 'EditPopoverView',
+ component: EditSimple,
+ },
+ {
+ path: '/:view/:firstDay/edit/sidebar/:object/:recurrenceId',
+ name: 'EditSidebarView',
+ component: EditSidebar,
+ },
+ {
+ path: '/:view/:firstDay/new/popover/:allDay/:dtstart/:dtend',
+ name: 'NewPopoverView',
+ component: EditSimple,
+ },
+ {
+ path: '/:view/:firstDay/new/sidebar/:allDay/:dtstart/:dtend',
+ name: 'NewSidebarView',
+ component: EditSidebar,
+ },
+ ],
+ },
+ ],
+})
+
+export default router