Files
2026-07-03 17:08:52 -07:00

117 lines
5.4 KiB
PHP

<?php
declare(strict_types=1);
namespace OCA\NuqloudScrum\Settings;
use OCA\NuqloudScrum\AppInfo\Application;
use OCA\NuqloudScrum\Service\ConfigService;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Settings\ISettings;
use OCP\Util;
class AdminSettings implements ISettings {
public function __construct(
private IL10N $l,
private IURLGenerator $urlGenerator,
private ConfigService $configService,
) {
}
public function getForm(): TemplateResponse {
Util::addStyle(Application::APP_ID, 'admin');
Util::addScript(Application::APP_ID, 'admin');
return new TemplateResponse(
Application::APP_ID,
'admin',
[
'title' => $this->l->t('NuQloud Scrum'),
'settings' => $this->configService->getPublicSettings(),
'settingsUrl' => $this->urlGenerator->linkToRoute('nuqloud_scrum.settings.save'),
'workspacesUrl' => $this->urlGenerator->linkToRoute('nuqloud_scrum.workspace.listWorkspaces'),
'workspaceToggleUrl' => $this->urlGenerator->linkToRoute('nuqloud_scrum.workspace.setSyncEnabled', ['workspaceId' => 'WORKSPACE_ID']),
'workspaceTasksUrl' => $this->urlGenerator->linkToRoute('nuqloud_scrum.workspace.listWorkspaceTasks', ['workspaceId' => 'WORKSPACE_ID']),
'syncWorkspacesUrl' => $this->urlGenerator->linkToRoute('nuqloud_scrum.workspace.sync'),
'syncMessagesUrl' => $this->urlGenerator->linkToRoute('nuqloud_scrum.workspace.syncMessages'),
'text' => $this->getText(),
],
''
);
}
/** @return array<string, string> */
private function getText(): array {
return [
'title' => $this->l->t('NuQloud Scrum'),
'savedMessage' => $this->l->t('Settings saved.'),
'errorMessage' => $this->l->t('Unable to save settings.'),
'syncCompleteMessage' => $this->l->t('Workspace sync complete.'),
'syncErrorMessage' => $this->l->t('Unable to sync workspaces.'),
'messageSyncCompleteMessage' => $this->l->t('Message sync complete.'),
'messageSyncErrorMessage' => $this->l->t('Unable to sync messages.'),
'intro' => $this->l->t('Talk conversations become scrum workspaces, while folders and Deck stay synchronized as mirrors.'),
'sync' => $this->l->t('Sync'),
'enableAutomation' => $this->l->t('Enable NuQloud Scrum automation'),
'syncInterval' => $this->l->t('Sync interval in minutes'),
'workspaceFilter' => $this->l->t('Workspace filter'),
'disabled' => $this->l->t('Disabled'),
'selectedConversations' => $this->l->t('Selected conversations'),
'allowlist' => $this->l->t('Allowlist'),
'allVisibleConversations' => $this->l->t('All visible conversations'),
'workspaceAllowlist' => $this->l->t('Workspace allowlist'),
'workspaceAllowlistPlaceholder' => $this->l->t('One Talk token or conversation name per line'),
'automationUser' => $this->l->t('Automation User'),
'credentialsConfigured' => $this->l->t('Automation credentials are configured.'),
'credentialsNotConfigured' => $this->l->t('Automation credentials are not configured.'),
'automationCredentialSource' => $this->l->t('Automation account source'),
'manualAppPassword' => $this->l->t('Manual app password'),
'nextcloudAdminEnvAccount' => $this->l->t('Nextcloud admin env account'),
'nextcloudServiceEnvAccount' => $this->l->t('Nextcloud service env account'),
'envAccountUnavailable' => $this->l->t('env unavailable'),
'talkServiceUser' => $this->l->t('Talk automation user'),
'talkServiceAppPassword' => $this->l->t('Talk automation app password'),
'leaveBlank' => $this->l->t('Leave blank to keep existing'),
'clearPassword' => $this->l->t('Clear saved app password'),
'mirrors' => $this->l->t('Mirrors'),
'mirrorDeck' => $this->l->t('Mirror tasks to Deck'),
'mirrorFiles' => $this->l->t('Mirror shared files into workspace folders'),
'fileMirrorMode' => $this->l->t('File mirror mode'),
'copyFiles' => $this->l->t('Copy files'),
'storeLinksOnly' => $this->l->t('Store links only'),
'talkControls' => $this->l->t('Talk Controls'),
'useReactions' => $this->l->t('Use reactions for task status'),
'enableBotCommands' => $this->l->t('Enable bot-style task commands'),
'generateSummaries' => $this->l->t('Generate workspace summaries'),
'saveSettings' => $this->l->t('Save settings'),
'syncWorkspacesNow' => $this->l->t('Sync workspaces now'),
'syncMessagesNow' => $this->l->t('Sync messages now'),
'filesUpdated' => $this->l->t('file reference(s) updated.'),
'conversationScrum' => $this->l->t('Conversation Scrum'),
'conversationScrumIntro' => $this->l->t('Enable Scrum only for the Talk conversations that should become task workspaces.'),
'loadConversations' => $this->l->t('Load conversations'),
'noConversations' => $this->l->t('No Talk conversations have been discovered yet.'),
'enableScrum' => $this->l->t('Enable Scrum'),
'disableScrum' => $this->l->t('Disable Scrum'),
'scrumEnabled' => $this->l->t('Scrum enabled'),
'scrumDisabled' => $this->l->t('Scrum disabled'),
'workspaceListError' => $this->l->t('Unable to load conversations.'),
'workspaceToggleError' => $this->l->t('Unable to update conversation Scrum status.'),
'viewTasks' => $this->l->t('View tasks'),
'hideTasks' => $this->l->t('Hide tasks'),
'noTasks' => $this->l->t('No tasks have been synced for this conversation yet.'),
'taskListError' => $this->l->t('Unable to load tasks.'),
];
}
public function getSection(): string {
return Application::APP_ID;
}
public function getPriority(): int {
return 40;
}
}