You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CalDavSettings.vue 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <div class="section">
  3. <h2>{{ $t('dav', 'Calendar server') }}</h2>
  4. <!-- Can use v-html as:
  5. - $t passes the translated string through DOMPurify.sanitize,
  6. - replacement strings are not user-controlled. -->
  7. <!-- eslint-disable-next-line vue/no-v-html -->
  8. <p class="settings-hint" v-html="hint" />
  9. <p>
  10. <input
  11. id="caldavSendInvitations"
  12. v-model="sendInvitations"
  13. type="checkbox"
  14. class="checkbox">
  15. <label for="caldavSendInvitations">
  16. {{ $t('dav', 'Send invitations to attendees') }}
  17. </label>
  18. <br>
  19. <!-- Can use v-html as:
  20. - $t passes the translated string through DOMPurify.sanitize,
  21. - replacement strings are not user-controlled. -->
  22. <!-- eslint-disable-next-line vue/no-v-html -->
  23. <em v-html="sendInvitationsHelpText" />
  24. </p>
  25. <p>
  26. <input
  27. id="caldavGenerateBirthdayCalendar"
  28. v-model="generateBirthdayCalendar"
  29. type="checkbox"
  30. class="checkbox">
  31. <label for="caldavGenerateBirthdayCalendar">
  32. {{ $t('dav', 'Automatically generate a birthday calendar') }}
  33. </label>
  34. <br>
  35. <em>
  36. {{ $t('dav', 'Birthday calendars will be generated by a background job.') }}
  37. </em>
  38. <br>
  39. <em>
  40. {{ $t('dav', 'Hence they will not be available immediately after enabling but will show up after some time.') }}
  41. </em>
  42. </p>
  43. <p>
  44. <input
  45. id="caldavSendEventReminders"
  46. v-model="sendEventReminders"
  47. type="checkbox"
  48. class="checkbox">
  49. <label for="caldavSendEventReminders">
  50. {{ $t('dav', 'Send notifications for events') }}
  51. </label>
  52. <br>
  53. <!-- Can use v-html as:
  54. - $t passes the translated string through DOMPurify.sanitize,
  55. - replacement strings are not user-controlled. -->
  56. <!-- eslint-disable-next-line vue/no-v-html -->
  57. <em v-html="sendEventRemindersHelpText" />
  58. <br>
  59. <em>
  60. {{ $t('dav', 'Notifications are sent via background jobs, so these must occur often enough.') }}
  61. </em>
  62. </p>
  63. <p>
  64. <input
  65. id="caldavSendEventRemindersPush"
  66. v-model="sendEventRemindersPush"
  67. type="checkbox"
  68. class="checkbox"
  69. :disabled="!sendEventReminders">
  70. <label for="caldavSendEventRemindersPush">
  71. {{ $t('dav', 'Enable notifications for events via push') }}
  72. </label>
  73. </p>
  74. </div>
  75. </template>
  76. <script>
  77. import axios from '@nextcloud/axios'
  78. import { generateUrl } from '@nextcloud/router'
  79. export default {
  80. name: 'CalDavSettings',
  81. computed: {
  82. hint() {
  83. const translated = this.$t(
  84. 'dav',
  85. 'Also install the {calendarappstoreopen}Calendar app{linkclose}, or {calendardocopen}connect your desktop & mobile for syncing ↗{linkclose}.',
  86. )
  87. return translated
  88. .replace('{calendarappstoreopen}', '<a target="_blank" href="../apps/office/calendar">')
  89. .replace('{calendardocopen}', '<a target="_blank" :href="userSyncCalendarsUrl" rel="noreferrer noopener">')
  90. .replace(/\{linkclose\}/g, '</a>')
  91. },
  92. sendInvitationsHelpText() {
  93. const translated = this.$t('dav', 'Please make sure to properly set up {emailopen}the email server{linkclose}.')
  94. return translated
  95. .replace('{emailopen}', '<a href="../admin#mail_general_settings">')
  96. .replace('{linkclose}', '</a>')
  97. },
  98. sendEventRemindersHelpText() {
  99. const translated = this.$t('dav', 'Please make sure to properly set up {emailopen}the email server{linkclose}.')
  100. return translated
  101. .replace('{emailopen}', '<a href="../admin#mail_general_settings">')
  102. .replace('{linkclose}', '</a>')
  103. },
  104. },
  105. watch: {
  106. generateBirthdayCalendar(value) {
  107. const baseUrl = value ? '/apps/dav/enableBirthdayCalendar' : '/apps/dav/disableBirthdayCalendar'
  108. axios.post(generateUrl(baseUrl))
  109. },
  110. sendInvitations(value) {
  111. OCP.AppConfig.setValue(
  112. 'dav',
  113. 'sendInvitations',
  114. value ? 'yes' : 'no'
  115. )
  116. },
  117. sendEventReminders(value) {
  118. OCP.AppConfig.setValue('dav', 'sendEventReminders', value ? 'yes' : 'no')
  119. },
  120. sendEventRemindersPush(value) {
  121. OCP.AppConfig.setValue('dav', 'sendEventRemindersPush', value ? 'yes' : 'no')
  122. },
  123. },
  124. }
  125. </script>