Add toggle for calendar feature with OCC

Signed-off-by: Fledermaus-20 <benno.traub@icloud.com>
This commit is contained in:
Fledermaus-20
2025-06-24 12:10:05 +02:00
parent 4e70286629
commit b73c2becda
19 changed files with 164 additions and 21 deletions

View File

@@ -24,7 +24,7 @@ jobs:
- name: Set up npm7
run: npm i -g npm@7
- name: Setup PHP
uses: shivammathur/setup-php@2.33.0
uses: shivammathur/setup-php@2.34.1
with:
php-version: '7.4'
tools: composer

View File

@@ -87,7 +87,7 @@ jobs:
filename: ${{ env.APP_NAME }}/appinfo/info.xml
- name: Set up php ${{ steps.php-versions.outputs.php-min }}
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2.33.0
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1
with:
php-version: ${{ steps.php-versions.outputs.php-min }}
coverage: none

View File

@@ -91,7 +91,7 @@ jobs:
restore-keys: ${{ steps.extcache.outputs.key }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@2.33.0
uses: shivammathur/setup-php@2.34.1
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}

View File

@@ -78,7 +78,7 @@ jobs:
path: apps/activity
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@2.33.0
uses: shivammathur/setup-php@2.34.1
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, mysql, pdo_mysql, pgsql, pdo_pgsql, apcu, gd

View File

@@ -34,7 +34,7 @@ jobs:
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
- name: Set up php${{ steps.versions.outputs.php-min }}
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2.33.0
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1
with:
php-version: ${{ steps.versions.outputs.php-min }}
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite

View File

@@ -48,7 +48,7 @@ jobs:
persist-credentials: false
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2.33.0
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1
with:
php-version: ${{ matrix.php-versions }}
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite

View File

@@ -103,7 +103,7 @@ jobs:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2.33.0
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1
with:
php-version: ${{ matrix.php-versions }}
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation

View File

@@ -106,7 +106,7 @@ jobs:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2.33.0
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1
with:
php-version: ${{ matrix.php-versions }}
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation

View File

@@ -95,7 +95,7 @@ jobs:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2.33.0
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1
with:
php-version: ${{ matrix.php-versions }}
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation

View File

@@ -36,7 +36,7 @@ jobs:
run: grep 'phpVersion="${{ steps.versions.outputs.php-min }}' psalm.xml
- name: Set up php${{ steps.versions.outputs.php-min }}
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2.33.0
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1
with:
php-version: ${{ steps.versions.outputs.php-min }}
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite

View File

@@ -38,7 +38,7 @@ jobs:
- name: Set up php8.2
if: steps.checkout.outcome == 'success'
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2.33.0
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1
with:
php-version: 8.2
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation

View File

@@ -62,6 +62,7 @@
<command>OCA\Deck\Command\UserExport</command>
<command>OCA\Deck\Command\BoardImport</command>
<command>OCA\Deck\Command\TransferOwnership</command>
<command>OCA\Deck\Command\CalendarToggle</command>
</commands>
<activity>
<settings>

View File

@@ -16,7 +16,8 @@
"phpunit/phpunit": "^9",
"nextcloud/coding-standard": "^1.1",
"nextcloud/ocp": "dev-master",
"psalm/phar": "^5.13"
"psalm/phar": "^5.13",
"friendsofphp/php-cs-fixer": "*"
},
"config": {
"optimize-autoloader": true,

2
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "6950663d9d213151028e780637480220",
"content-hash": "2a3a67d1b7c70fe1cee2183c26b0c906",
"packages": [
{
"name": "justinrainbow/json-schema",

View File

@@ -1,23 +1,45 @@
OC.L10N.register(
"deck",
{
"You have created a new board {board}" : "Sa oled koostanud uue tahvli: {board}",
"{user} has created a new board {board}" : "{user} on koostanud uue tahvli: {board}",
"You have deleted the board {board}" : "Sa oled kustutanud tahvli: {board}",
"{user} has deleted the board {board}" : "{user} on kustutanud tahvli: {board}",
"You have restored the board {board}" : "Sa oled taastanud tahvli: {board}",
"{user} has restored the board {board}" : "{user} on taastanud tahvli: {board}",
"You have shared the board {board} with {acl}" : "Sa oled jaganud {board} tahvlit: {acl}",
"{user} has shared the board {board} with {acl}" : "{user} on jaganud {board} tahvlit: {acl}",
"You have removed {acl} from the board {board}" : "Sa oled eemaldanud {acl} ligipääsu tahvlilt {board}",
"{user} has removed {acl} from the board {board}" : "{user} on eemaldanud {acl} ligipääsu tahvlilt {board}",
"You have renamed the board {before} to {board}" : "Sa oled muutnud tahvli nime: {before} → {board}",
"{user} has renamed the board {before} to {board}" : "{user} on muutnud tahvli nime: {before} → {board}",
"You have archived the board {board}" : "Sa oled {board} tahvli arhiveerinud",
"{user} has archived the board {before}" : "{user} on {before} tahvli arhiveerinud",
"Deck" : "Deck",
"The file was uploaded" : "Fail laaditi üles",
"The uploaded file exceeds the upload_max_filesize directive in php.ini" : "Üleslaetud fail on suurem, kui php.ini failis määratud upload_max_filesize",
"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" : "Üleslaetud fail on suurem, kui MAX_FILE_SIZE atribuut, mis seadistati HTML vormis",
"The file was only partially uploaded" : "Fail laaditi üles ainult osaliselt",
"No file was uploaded" : "Ühtegi faili ei latud üles",
"Missing a temporary folder" : "Ajutine kausta on puudu",
"Could not write file to disk" : "Faili kirjutamine kettale ebaõnnestus",
"No file was uploaded" : "Ühtegi faili ei laaditud üles",
"Missing a temporary folder" : "Ajutine kaust on puudu",
"Could not write file to disk" : "Faili kirjutamine kettale ei õnnestunud",
"A PHP extension stopped the file upload" : "PHP laiendus peatas faili üleslaadimise",
"No file uploaded or file size exceeds maximum of %s" : "Faili ei laaditud üles või selle suurus ületab maksimaalse %s",
"Invalid file type. Only JSON files are allowed." : "Vigane failitüüp. Vaid JSON-failid on lubatud.",
"Invalid JSON data" : "Vigased JSON-i andmed",
"Failed to import board" : "Tahvli importimine ei õnnestunud",
"Cards due today" : "Kaardid, mille tähtaeg on täna",
"Cards due tomorrow" : "Kaardid, mille tähtaeg on homme",
"Load more" : "Laadi veel",
"Deck board" : "Kanbani tahvel",
"Owned by %1$s" : "Omanik: %1$s",
"Create a new deck card" : "Koosta uus kanbani kaart",
"Card comments" : "Kaardi kommentaarid",
"%s on %s" : "%s %s-l",
"Deck boards and cards" : "Kanbani tahvlid ja kaardid",
"No data was provided to create an attachment." : "Polnud andmeid, millest luua manust.",
"Finished" : "Lõpetatud",
"To review" : "Ülevaatamiseks",
"Later" : "Hiljem",
"copy" : "koopia",
"To Do" : "Tegemiseks",
@@ -25,9 +47,21 @@ OC.L10N.register(
"Done" : "Valmis",
"Create your first card!" : "Koosta oma esimene kaart!",
"Invalid date, date format must be YYYY-MM-DD" : "Vigane kuupäev, formaat peab olema YYYY-MM-DD",
"Add board" : "Lisa tahvel",
"Card details" : "Kaardi üksikasjad",
"Search by board title" : "Otsi tahvli pealkirja alusel",
"Select board" : "Vali tahvel",
"Move/copy card" : "Teisalda või kopeeri kaart",
"Select a board" : "Vali tahvel",
"No lists available" : "Loendeid pole saadaval",
"Select a list" : "Vali loend",
"Move card" : "Teisalda kaart",
"Copy card" : "Kopeeri kaart",
"Cancel" : "Loobu",
"Select the card to link to a project" : "Vali kaart, mida projektis viidata",
"Link to card" : "Lisa link kaardile",
"Select a card" : "Vali kaart",
"Cancel" : "Katkesta",
"This board is read only" : "See tahvle on vaid loetav",
"Drop your files to upload" : "Üleslaadimiseks lohista failid siia",
"File already exists" : "Fail on juba olemas",
"Add list" : "Lisa loend",

View File

@@ -1,21 +1,43 @@
{ "translations": {
"You have created a new board {board}" : "Sa oled koostanud uue tahvli: {board}",
"{user} has created a new board {board}" : "{user} on koostanud uue tahvli: {board}",
"You have deleted the board {board}" : "Sa oled kustutanud tahvli: {board}",
"{user} has deleted the board {board}" : "{user} on kustutanud tahvli: {board}",
"You have restored the board {board}" : "Sa oled taastanud tahvli: {board}",
"{user} has restored the board {board}" : "{user} on taastanud tahvli: {board}",
"You have shared the board {board} with {acl}" : "Sa oled jaganud {board} tahvlit: {acl}",
"{user} has shared the board {board} with {acl}" : "{user} on jaganud {board} tahvlit: {acl}",
"You have removed {acl} from the board {board}" : "Sa oled eemaldanud {acl} ligipääsu tahvlilt {board}",
"{user} has removed {acl} from the board {board}" : "{user} on eemaldanud {acl} ligipääsu tahvlilt {board}",
"You have renamed the board {before} to {board}" : "Sa oled muutnud tahvli nime: {before} → {board}",
"{user} has renamed the board {before} to {board}" : "{user} on muutnud tahvli nime: {before} → {board}",
"You have archived the board {board}" : "Sa oled {board} tahvli arhiveerinud",
"{user} has archived the board {before}" : "{user} on {before} tahvli arhiveerinud",
"Deck" : "Deck",
"The file was uploaded" : "Fail laaditi üles",
"The uploaded file exceeds the upload_max_filesize directive in php.ini" : "Üleslaetud fail on suurem, kui php.ini failis määratud upload_max_filesize",
"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" : "Üleslaetud fail on suurem, kui MAX_FILE_SIZE atribuut, mis seadistati HTML vormis",
"The file was only partially uploaded" : "Fail laaditi üles ainult osaliselt",
"No file was uploaded" : "Ühtegi faili ei latud üles",
"Missing a temporary folder" : "Ajutine kausta on puudu",
"Could not write file to disk" : "Faili kirjutamine kettale ebaõnnestus",
"No file was uploaded" : "Ühtegi faili ei laaditud üles",
"Missing a temporary folder" : "Ajutine kaust on puudu",
"Could not write file to disk" : "Faili kirjutamine kettale ei õnnestunud",
"A PHP extension stopped the file upload" : "PHP laiendus peatas faili üleslaadimise",
"No file uploaded or file size exceeds maximum of %s" : "Faili ei laaditud üles või selle suurus ületab maksimaalse %s",
"Invalid file type. Only JSON files are allowed." : "Vigane failitüüp. Vaid JSON-failid on lubatud.",
"Invalid JSON data" : "Vigased JSON-i andmed",
"Failed to import board" : "Tahvli importimine ei õnnestunud",
"Cards due today" : "Kaardid, mille tähtaeg on täna",
"Cards due tomorrow" : "Kaardid, mille tähtaeg on homme",
"Load more" : "Laadi veel",
"Deck board" : "Kanbani tahvel",
"Owned by %1$s" : "Omanik: %1$s",
"Create a new deck card" : "Koosta uus kanbani kaart",
"Card comments" : "Kaardi kommentaarid",
"%s on %s" : "%s %s-l",
"Deck boards and cards" : "Kanbani tahvlid ja kaardid",
"No data was provided to create an attachment." : "Polnud andmeid, millest luua manust.",
"Finished" : "Lõpetatud",
"To review" : "Ülevaatamiseks",
"Later" : "Hiljem",
"copy" : "koopia",
"To Do" : "Tegemiseks",
@@ -23,9 +45,21 @@
"Done" : "Valmis",
"Create your first card!" : "Koosta oma esimene kaart!",
"Invalid date, date format must be YYYY-MM-DD" : "Vigane kuupäev, formaat peab olema YYYY-MM-DD",
"Add board" : "Lisa tahvel",
"Card details" : "Kaardi üksikasjad",
"Search by board title" : "Otsi tahvli pealkirja alusel",
"Select board" : "Vali tahvel",
"Move/copy card" : "Teisalda või kopeeri kaart",
"Select a board" : "Vali tahvel",
"No lists available" : "Loendeid pole saadaval",
"Select a list" : "Vali loend",
"Move card" : "Teisalda kaart",
"Copy card" : "Kopeeri kaart",
"Cancel" : "Loobu",
"Select the card to link to a project" : "Vali kaart, mida projektis viidata",
"Link to card" : "Lisa link kaardile",
"Select a card" : "Vali kaart",
"Cancel" : "Katkesta",
"This board is read only" : "See tahvle on vaid loetav",
"Drop your files to upload" : "Üleslaadimiseks lohista failid siia",
"File already exists" : "Fail on juba olemas",
"Add list" : "Lisa loend",

View File

@@ -160,8 +160,11 @@ OC.L10N.register(
"Export" : "Exportar",
"Today" : "Hoje",
"Tomorrow" : "Amanhã",
"No results found" : "No results found",
"Due on {date}" : "Due on {date}",
"Create card" : "Criar cartão",
"Close" : "Fechar",
"Failed to upload {name}" : "Failed to upload {name}",
"Due date" : "Data limite",
"Share" : "Partilhar",
"Personal" : "Pessoal",

View File

@@ -158,8 +158,11 @@
"Export" : "Exportar",
"Today" : "Hoje",
"Tomorrow" : "Amanhã",
"No results found" : "No results found",
"Due on {date}" : "Due on {date}",
"Create card" : "Criar cartão",
"Close" : "Fechar",
"Failed to upload {name}" : "Failed to upload {name}",
"Due date" : "Data limite",
"Share" : "Partilhar",
"Personal" : "Pessoal",

View File

@@ -0,0 +1,67 @@
<?php
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Deck\Command;
use OCP\IConfig;
use OCP\IUserManager;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class CalendarToggle extends Command {
private IUserManager $userManager;
private IConfig $config;
public function __construct(IUserManager $userManager, IConfig $config) {
parent::__construct();
$this->userManager = $userManager;
$this->config = $config;
}
protected function configure() {
$this
->setName('deck:calendar-toggle')
->setDescription('Enable or disable Deck calendar/tasks integration for all existing users. Users can still change their own setting afterwards. Only affects users that already exist at the time of execution.')
->addOption(
'on',
null,
InputOption::VALUE_NONE,
'Enable calendar/tasks integration for all existing users (users can opt-out later)'
)
->addOption(
'off',
null,
InputOption::VALUE_NONE,
'Disable calendar/tasks integration for all existing users (users can opt-in later)'
);
}
protected function execute(InputInterface $input, OutputInterface $output): int {
$enable = $input->getOption('on');
$disable = $input->getOption('off');
if ($enable && $disable) {
$output->writeln('<error>Cannot use --on and --off together.</error>');
return 1;
}
if (!$enable && !$disable) {
$output->writeln('<error>Please specify either --on or --off.</error>');
return 1;
}
$value = $enable ? 'yes' : '';
$users = $this->userManager->search('');
$count = 0;
foreach ($users as $user) {
$uid = $user->getUID();
$this->config->setUserValue($uid, 'deck', 'calendar', $value);
$output->writeln("Set calendar integration to '" . ($enable ? 'on' : 'off') . "' for user: $uid");
$count++;
}
$output->writeln("Done. Updated $count existing users.");
return 0;
}
}