From c87396aa85c09c2344c3982f87a4e28ea4b7f273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 29 Nov 2019 20:13:39 +0100 Subject: Remove template creator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/DirectEditing/TextDirectEditor.php | 2 - lib/DirectEditing/TextDocumentCreator.php | 5 -- lib/DirectEditing/TextDocumentTemplateCreator.php | 82 ----------------------- 3 files changed, 89 deletions(-) delete mode 100644 lib/DirectEditing/TextDocumentTemplateCreator.php (limited to 'lib') diff --git a/lib/DirectEditing/TextDirectEditor.php b/lib/DirectEditing/TextDirectEditor.php index cb6e06879..6bf4026b2 100644 --- a/lib/DirectEditing/TextDirectEditor.php +++ b/lib/DirectEditing/TextDirectEditor.php @@ -23,7 +23,6 @@ namespace OCA\Text\DirectEditing; -use OCA\Files\Controller\ApiController; use OCA\Text\AppInfo\Application; use OCA\Text\Service\ApiService; use OCP\AppFramework\Http\NotFoundResponse; @@ -106,7 +105,6 @@ class TextDirectEditor implements IEditor { public function getCreators(): array { return [ new TextDocumentCreator($this->l10n), - new TextDocumentTemplateCreator($this->l10n) ]; } diff --git a/lib/DirectEditing/TextDocumentCreator.php b/lib/DirectEditing/TextDocumentCreator.php index 2fa1b5472..a8976aa8c 100644 --- a/lib/DirectEditing/TextDocumentCreator.php +++ b/lib/DirectEditing/TextDocumentCreator.php @@ -55,9 +55,4 @@ class TextDocumentCreator extends ACreateEmpty { return 'text/markdown'; } - public function create(File $file, string $creatorId = null, string $templateId = null): void { - parent::create($file, $creatorId, $templateId); // TODO: Change the autogenerated stub - - $file->putContent('## Empty document with Nextcloud Text'); - } } diff --git a/lib/DirectEditing/TextDocumentTemplateCreator.php b/lib/DirectEditing/TextDocumentTemplateCreator.php deleted file mode 100644 index 6e5668bb7..000000000 --- a/lib/DirectEditing/TextDocumentTemplateCreator.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * @author Julius Härtl - * - * @license GNU AGPL version 3 or any later version - * - * 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 . - * - */ - -namespace OCA\Text\DirectEditing; - - -use OCP\DirectEditing\ACreateFromTemplate; -use OCP\Files\File; -use OCP\IL10N; - -class TextDocumentTemplateCreator extends ACreateFromTemplate { - - const TEMPLATES = [ - '1' => [ - 'id' => '1', - 'extension' => 'md', - 'name' => 'Weekly ToDo', - 'preview' => 'https://cloud.bitgrid.net/apps/richdocuments/template/preview/832537' - ], - '2' => [ - 'id' => '2', - 'extension' => 'md', - 'name' => 'Meeting notes', - 'preview' => 'https://cloud.bitgrid.net/apps/richdocuments/template/preview/832537' - ] - ]; - - /** - * @var IL10N - */ - private $l10n; - - public function __construct(IL10N $l10n) { - $this->l10n = $l10n; - } - - public function getId(): string { - return 'textdocumenttemplate'; - } - - public function getName(): string { - return $this->l10n->t('New text document from template'); - } - - public function getExtension(): string { - return '.md'; - } - - public function getTemplates(): array { - return self::TEMPLATES; - } - - public function getMimetype(): string { - return 'text/markdown'; - } - - public function create(File $file, string $creatorId = null, string $templateId = null): void { - $template = self::TEMPLATES[$templateId]; - $file->putContent('## ' . $template['name'] . '\n\n' . 'Created from a template with Nextcloud text'); - } - -} -- cgit v1.2.3