From 5ec5fea0480de541770589eb49911982d0213b36 Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Thu, 4 Oct 2018 19:54:04 -0400 Subject: [PATCH 01/17] Update Postgres.php --- Schema/Postgres.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Schema/Postgres.php b/Schema/Postgres.php index 82ed3f4..18955ce 100644 --- a/Schema/Postgres.php +++ b/Schema/Postgres.php @@ -8,9 +8,9 @@ function version_3(PDO $pdo) { - $pdo->exec('ALTER TABLE files ADD COLUMN "date" INTEGER NOT NULL DEFAULT 0'); - $pdo->exec('ALTER TABLE files ADD COLUMN "user_id" INTEGER NOT NULL DEFAULT 0'); - $pdo->exec('ALTER TABLE files ADD COLUMN "size" INTEGER NOT NULL DEFAULT 0'); + $pdo->exec('ALTER TABLE wikipage_has_files ADD COLUMN "date" INTEGER NOT NULL DEFAULT 0'); + $pdo->exec('ALTER TABLE wikipage_has_files ADD COLUMN "user_id" INTEGER NOT NULL DEFAULT 0'); + $pdo->exec('ALTER TABLE wikipage_has_files ADD COLUMN "size" INTEGER NOT NULL DEFAULT 0'); } function version_2(PDO $pdo) From f1064453108000541c200f5c45745854745f8270 Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Thu, 4 Oct 2018 20:15:31 -0400 Subject: [PATCH 02/17] Create show.php --- Template/file_viewer/show.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Template/file_viewer/show.php diff --git a/Template/file_viewer/show.php b/Template/file_viewer/show.php new file mode 100644 index 0000000..1d5fe30 --- /dev/null +++ b/Template/file_viewer/show.php @@ -0,0 +1,14 @@ + +
+ + <?= $this->text->e($file['name']) ?> + +
+ text->markdown($content) ?> +
+ +
+ +
From a086dd4e47aff35ec5a812bb2ea6f6055e72d157 Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Thu, 4 Oct 2018 20:17:26 -0400 Subject: [PATCH 03/17] Update Plugin.php --- Plugin.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugin.php b/Plugin.php index df0a189..47813e6 100755 --- a/Plugin.php +++ b/Plugin.php @@ -38,6 +38,8 @@ public function initialize() $this->template->hook->attach('template:project-list:menu:after', 'wiki:wiki_list/menu'); $this->template->hook->attach('template:header:dropdown', 'wiki:header/dropdown'); + + $this->template->setTemplateOverride('file_viewer/show', 'wiki:file_viewer/show'); $this->hook->on('template:layout:css', array('template' => 'plugins/Wiki/Asset/css/wiki.css')); $this->hook->on('template:layout:js', array('template' => 'plugins/Wiki/Asset/Javascript/wiki.js')); From f4c93f180cf51a434855778b8c4eed7c8f70d8e4 Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Thu, 4 Oct 2018 20:30:59 -0400 Subject: [PATCH 04/17] Update show.php --- Template/file_viewer/show.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Template/file_viewer/show.php b/Template/file_viewer/show.php index 1d5fe30..8fd57d8 100644 --- a/Template/file_viewer/show.php +++ b/Template/file_viewer/show.php @@ -3,7 +3,7 @@
- <?= $this->text->e($file['name']) ?> + <?= $this->text->e($file['name']) ?>
text->markdown($content) ?> From 6ccc6e444a4258034ba0e66b729a1bf09d39396b Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Thu, 4 Oct 2018 21:17:18 -0400 Subject: [PATCH 05/17] Update images.php --- Template/wiki_file/images.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Template/wiki_file/images.php b/Template/wiki_file/images.php index 6ef28fb..c841a3e 100644 --- a/Template/wiki_file/images.php +++ b/Template/wiki_file/images.php @@ -5,7 +5,7 @@ app->component('image-slideshow', array( 'images' => $images, 'image' => $file, - 'regex' => 'FILE_ID', + 'regex' => 'FID', 'url' => array( 'image' => $this->url->to('WikiFileViewController', 'image', array('plugin' => 'wiki', 'file_id' => 'FILE_ID', 'project_id' => $wiki['project_id'], 'wikipage_id' => $wiki['id'], 'fid' => $file['id'])), 'thumbnail' => $this->url->to('WikiFileViewController', 'thumbnail', array('plugin' => 'wiki', 'file_id' => 'FILE_ID', 'project_id' => $wiki['project_id'], 'wikipage_id' => $wiki['id'], 'fid' => $file['id'])), From 1e68d249bbcc3bb1281325fb9d93e85df5bcaa89 Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Thu, 4 Oct 2018 21:19:51 -0400 Subject: [PATCH 06/17] Update images.php --- Template/wiki_file/images.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Template/wiki_file/images.php b/Template/wiki_file/images.php index c841a3e..6ef28fb 100644 --- a/Template/wiki_file/images.php +++ b/Template/wiki_file/images.php @@ -5,7 +5,7 @@ app->component('image-slideshow', array( 'images' => $images, 'image' => $file, - 'regex' => 'FID', + 'regex' => 'FILE_ID', 'url' => array( 'image' => $this->url->to('WikiFileViewController', 'image', array('plugin' => 'wiki', 'file_id' => 'FILE_ID', 'project_id' => $wiki['project_id'], 'wikipage_id' => $wiki['id'], 'fid' => $file['id'])), 'thumbnail' => $this->url->to('WikiFileViewController', 'thumbnail', array('plugin' => 'wiki', 'file_id' => 'FILE_ID', 'project_id' => $wiki['project_id'], 'wikipage_id' => $wiki['id'], 'fid' => $file['id'])), From adcd1be4cd11b48ba0b802161c8d2d68555f103a Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Thu, 4 Oct 2018 21:25:48 -0400 Subject: [PATCH 07/17] Update images.php --- Template/wiki_file/images.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Template/wiki_file/images.php b/Template/wiki_file/images.php index 6ef28fb..e6a5b44 100644 --- a/Template/wiki_file/images.php +++ b/Template/wiki_file/images.php @@ -5,11 +5,11 @@ app->component('image-slideshow', array( 'images' => $images, 'image' => $file, - 'regex' => 'FILE_ID', + 'regex' => 'FID', 'url' => array( - 'image' => $this->url->to('WikiFileViewController', 'image', array('plugin' => 'wiki', 'file_id' => 'FILE_ID', 'project_id' => $wiki['project_id'], 'wikipage_id' => $wiki['id'], 'fid' => $file['id'])), - 'thumbnail' => $this->url->to('WikiFileViewController', 'thumbnail', array('plugin' => 'wiki', 'file_id' => 'FILE_ID', 'project_id' => $wiki['project_id'], 'wikipage_id' => $wiki['id'], 'fid' => $file['id'])), - 'download' => $this->url->to('WikiFileViewController', 'download', array('plugin' => 'wiki', 'file_id' => 'FILE_ID', 'project_id' => $wiki['project_id'], 'wikipage_id' => $wiki['id'], 'fid' => $file['id'])), + 'image' => $this->url->to('WikiFileViewController', 'image', array('plugin' => 'wiki', 'file_id' => 'FID', 'project_id' => $wiki['project_id'], 'wikipage_id' => $wiki['id'], 'fid' => $file['id'])), + 'thumbnail' => $this->url->to('WikiFileViewController', 'thumbnail', array('plugin' => 'wiki', 'file_id' => 'FID', 'project_id' => $wiki['project_id'], 'wikipage_id' => $wiki['id'], 'fid' => $file['id'])), + 'download' => $this->url->to('WikiFileViewController', 'download', array('plugin' => 'wiki', 'file_id' => 'FID', 'project_id' => $wiki['project_id'], 'wikipage_id' => $wiki['id'], 'fid' => $file['id'])), ) )) ?> From 1899306be9afc292e08fdd127ef504e4f08f005b Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Thu, 4 Oct 2018 21:27:11 -0400 Subject: [PATCH 08/17] Update WikiFileViewController.php --- Controller/WikiFileViewController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Controller/WikiFileViewController.php b/Controller/WikiFileViewController.php index 5776b1c..d9a1ef7 100644 --- a/Controller/WikiFileViewController.php +++ b/Controller/WikiFileViewController.php @@ -89,7 +89,7 @@ public function show() */ public function image() { - $file = $this->wikiFile->getById($this->request->getIntegerParam('fid')); + $file = $this->wikiFile->getById($this->request->getIntegerParam('file_id')); $this->renderFileWithCache($file, $this->helper->file->getImageMimeType($file['name'])); } @@ -147,7 +147,7 @@ public function thumbnail() public function download() { try { - $file = $this->wikiFile->getById($this->request->getIntegerParam('fid')); + $file = $this->wikiFile->getById($this->request->getIntegerParam('file_id')); $file['model'] = 'wikiFile'; $this->response->withFileDownload($file['name']); $this->response->send(); From 8e739a61383c8cc0e59a7934e94d24cb9da687e4 Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Thu, 4 Oct 2018 21:38:02 -0400 Subject: [PATCH 09/17] Update show.php --- Template/file_viewer/show.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Template/file_viewer/show.php b/Template/file_viewer/show.php index 8fd57d8..05c9eb3 100644 --- a/Template/file_viewer/show.php +++ b/Template/file_viewer/show.php @@ -3,7 +3,7 @@
- <?= $this->text->e($file['name']) ?> + <?= $this->text->e($file['name']) ?>
text->markdown($content) ?> From b1b2886299dc4a2e6d6484c30c83bba6b6c8b053 Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Thu, 4 Oct 2018 21:40:48 -0400 Subject: [PATCH 10/17] Update WikiFileViewController.php --- Controller/WikiFileViewController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/WikiFileViewController.php b/Controller/WikiFileViewController.php index d9a1ef7..4dc88dd 100644 --- a/Controller/WikiFileViewController.php +++ b/Controller/WikiFileViewController.php @@ -66,7 +66,7 @@ protected function renderFileWithCache(array $file, $mimetype) */ public function show() { - $file = $file = $this->wikiFile->getById($this->request->getIntegerParam('fid')); + $file = $file = $this->wikiFile->getById($this->request->getIntegerParam('file_id')); $type = $this->helper->file->getPreviewType($file['name']); $params = array('file_id' => $file['id'], 'project_id' => $this->request->getIntegerParam('project_id')); From 879f42cf95541c1af6e5c82bec6042cf87857c0e Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Thu, 4 Oct 2018 21:43:13 -0400 Subject: [PATCH 11/17] Update WikiFileViewController.php --- Controller/WikiFileViewController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Controller/WikiFileViewController.php b/Controller/WikiFileViewController.php index 4dc88dd..9437c30 100644 --- a/Controller/WikiFileViewController.php +++ b/Controller/WikiFileViewController.php @@ -66,7 +66,7 @@ protected function renderFileWithCache(array $file, $mimetype) */ public function show() { - $file = $file = $this->wikiFile->getById($this->request->getIntegerParam('file_id')); + $file = $file = $this->wikiFile->getById($this->request->getIntegerParam('fid')); $type = $this->helper->file->getPreviewType($file['name']); $params = array('file_id' => $file['id'], 'project_id' => $this->request->getIntegerParam('project_id')); @@ -111,7 +111,7 @@ public function browser() */ public function thumbnail() { - $file = $this->wikiFile->getById($this->request->getIntegerParam('fid')); + $file = $this->wikiFile->getById($this->request->getIntegerParam('file_id')); $model = 'wikiFile'; $filename = $this->$model->getThumbnailPath($file['path']); $etag = md5($filename); From 6572a6b4a7db38d9d753fd900354b0c29dab94ae Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Thu, 4 Oct 2018 21:44:31 -0400 Subject: [PATCH 12/17] Update WikiFileViewController.php --- Controller/WikiFileViewController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Controller/WikiFileViewController.php b/Controller/WikiFileViewController.php index 9437c30..aaa06cf 100644 --- a/Controller/WikiFileViewController.php +++ b/Controller/WikiFileViewController.php @@ -66,7 +66,7 @@ protected function renderFileWithCache(array $file, $mimetype) */ public function show() { - $file = $file = $this->wikiFile->getById($this->request->getIntegerParam('fid')); + $file = $file = $this->wikiFile->getById($this->request->getIntegerParam('file_id')); $type = $this->helper->file->getPreviewType($file['name']); $params = array('file_id' => $file['id'], 'project_id' => $this->request->getIntegerParam('project_id')); @@ -100,7 +100,7 @@ public function image() */ public function browser() { - $file = $this->wikiFile->getById($this->request->getIntegerParam('fid')); + $file = $this->wikiFile->getById($this->request->getIntegerParam('file_id')); $this->renderFileWithCache($file, $this->helper->file->getBrowserViewType($file['name'])); } From a314f2d08884659e86156230863a4c36db95d0e1 Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Thu, 4 Oct 2018 21:50:50 -0400 Subject: [PATCH 13/17] Update WikiFileViewController.php --- Controller/WikiFileViewController.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Controller/WikiFileViewController.php b/Controller/WikiFileViewController.php index aaa06cf..0b9b7dc 100644 --- a/Controller/WikiFileViewController.php +++ b/Controller/WikiFileViewController.php @@ -5,12 +5,7 @@ use Kanboard\Core\ObjectStorage\ObjectStorageException; use Kanboard\Controller\BaseController; -/** - * File Viewer Controller - * - * @package Kanbaord\Controller - * @author Frederic Guillot - */ + class WikiFileViewController extends BaseController { /** @@ -66,7 +61,7 @@ protected function renderFileWithCache(array $file, $mimetype) */ public function show() { - $file = $file = $this->wikiFile->getById($this->request->getIntegerParam('file_id')); + $file = $file = $this->wikiFile->getById($this->request->getIntegerParam('fid')); $type = $this->helper->file->getPreviewType($file['name']); $params = array('file_id' => $file['id'], 'project_id' => $this->request->getIntegerParam('project_id')); From 35806d013b2b802b156832d85ce01be3e40aa3d5 Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Thu, 4 Oct 2018 21:58:56 -0400 Subject: [PATCH 14/17] Update WikiFileViewController.php --- Controller/WikiFileViewController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/WikiFileViewController.php b/Controller/WikiFileViewController.php index 0b9b7dc..d82ed53 100644 --- a/Controller/WikiFileViewController.php +++ b/Controller/WikiFileViewController.php @@ -95,7 +95,7 @@ public function image() */ public function browser() { - $file = $this->wikiFile->getById($this->request->getIntegerParam('file_id')); + $file = $this->wikiFile->getById($this->request->getIntegerParam('fid')); $this->renderFileWithCache($file, $this->helper->file->getBrowserViewType($file['name'])); } From a536406662e4fe81d5f8c09ee9fd2ebf05ebe73f Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Thu, 4 Oct 2018 22:41:13 -0400 Subject: [PATCH 15/17] Update images.php --- Template/wiki_file/images.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Template/wiki_file/images.php b/Template/wiki_file/images.php index e6a5b44..2188aec 100644 --- a/Template/wiki_file/images.php +++ b/Template/wiki_file/images.php @@ -5,11 +5,11 @@ app->component('image-slideshow', array( 'images' => $images, 'image' => $file, - 'regex' => 'FID', + 'regex' => 'FILE_ID', 'url' => array( - 'image' => $this->url->to('WikiFileViewController', 'image', array('plugin' => 'wiki', 'file_id' => 'FID', 'project_id' => $wiki['project_id'], 'wikipage_id' => $wiki['id'], 'fid' => $file['id'])), - 'thumbnail' => $this->url->to('WikiFileViewController', 'thumbnail', array('plugin' => 'wiki', 'file_id' => 'FID', 'project_id' => $wiki['project_id'], 'wikipage_id' => $wiki['id'], 'fid' => $file['id'])), - 'download' => $this->url->to('WikiFileViewController', 'download', array('plugin' => 'wiki', 'file_id' => 'FID', 'project_id' => $wiki['project_id'], 'wikipage_id' => $wiki['id'], 'fid' => $file['id'])), + 'image' => $this->url->to('WikiFileViewController', 'image', array('plugin' => 'wiki', 'file_id' => 'FILE_ID', 'project_id' => $wiki['project_id'], 'wikipage_id' => $wiki['id'])), + 'thumbnail' => $this->url->to('WikiFileViewController', 'thumbnail', array('plugin' => 'wiki', 'file_id' => 'FILE_ID', 'project_id' => $wiki['project_id'], 'wikipage_id' => $wiki['id'])), + 'download' => $this->url->to('WikiFileViewController', 'download', array('plugin' => 'wiki', 'file_id' => 'FILE_ID', 'project_id' => $wiki['project_id'], 'wikipage_id' => $wiki['id'])), ) )) ?> @@ -19,7 +19,7 @@ text->e($file['name']) ?>
  • - url->icon('download', t('Download'), 'WikiFileViewController', 'download', array('plugin' => 'wiki', 'wikipage_id' => $wiki['id'], 'project_id' => $wiki['project_id'], 'file_id' => $file['id'], 'fid' => $file['id'])) ?> + url->icon('download', t('Download'), 'WikiFileViewController', 'download', array('plugin' => 'wiki', 'wikipage_id' => $wiki['id'], 'project_id' => $wiki['project_id'], 'file_id' => $file['id'], 'file_id' => $file['id'])) ?>
  • user->hasProjectAccess('WikiFileController', 'remove', $wiki['project_id'])): ?>
  • From 094ab6d23fdcd8b18de412ee0c75a18fc7c3d4ae Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Tue, 16 Oct 2018 15:13:49 -0400 Subject: [PATCH 16/17] Update WikiFileViewController.php --- Controller/WikiFileViewController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/WikiFileViewController.php b/Controller/WikiFileViewController.php index d82ed53..247c0d7 100644 --- a/Controller/WikiFileViewController.php +++ b/Controller/WikiFileViewController.php @@ -61,7 +61,7 @@ protected function renderFileWithCache(array $file, $mimetype) */ public function show() { - $file = $file = $this->wikiFile->getById($this->request->getIntegerParam('fid')); + $file = $this->wikiFile->getById($this->request->getIntegerParam('fid')); $type = $this->helper->file->getPreviewType($file['name']); $params = array('file_id' => $file['id'], 'project_id' => $this->request->getIntegerParam('project_id')); From 9eb626290b94583b03f88f6e71a40caaefe0499c Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Mon, 29 Oct 2018 16:23:59 -0400 Subject: [PATCH 17/17] Update WikiFile.php Fixes funktechno/kanboard-plugin-wiki#22 --- Model/WikiFile.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Model/WikiFile.php b/Model/WikiFile.php index 79f5012..5a67e6f 100644 --- a/Model/WikiFile.php +++ b/Model/WikiFile.php @@ -106,4 +106,8 @@ protected function fireCreationEvent($file_id) return null; } + protected function fireDestructionEvent($file_id) + { + return null; + } }