-
Notifications
You must be signed in to change notification settings - Fork 19
Add wiki:<wiki_id> links in Kanboard #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
arturog
wants to merge
3
commits into
funktechno:dev
Choose a base branch
from
arturog:dev
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <?php | ||
|
|
||
| namespace Kanboard\Plugin\Wiki\Helper; | ||
|
|
||
| use Kanboard\Helper\TextHelper; | ||
| use ParsedownExtra; | ||
|
|
||
| class MarkdownHelper extends TextHelper | ||
| { | ||
| /** | ||
| * Markdown transformation | ||
| * | ||
| * @param string $text | ||
| * @param boolean $isPublicLink | ||
| * @return string | ||
| */ | ||
| public function markdown($text, $isPublicLink = false) | ||
| { | ||
| $parser = new WikiMarkdown($this->container, $isPublicLink); | ||
| $parser->setMarkupEscaped(MARKDOWN_ESCAPE_HTML); | ||
| $parser->setBreaksEnabled(true); | ||
| $parser->setContainer($this->container); | ||
|
|
||
| return $parser->text($text ?: ''); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,6 @@ | |
| use Kanboard\Core\Base; | ||
| use Kanboard\Model\Wiki; | ||
|
|
||
|
|
||
| class WikiHelper extends Base | ||
| { | ||
| /** | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| <?php | ||
|
|
||
| namespace Kanboard\Plugin\Wiki\Helper; | ||
|
|
||
| use Kanboard\Core\Markdown; | ||
| use Kanboard\Helper\TextHelper; | ||
| use Kanboard\Helper\UrlHelper; | ||
|
|
||
| class WikiMarkdown extends Markdown | ||
| { | ||
| public function setContainer($container) | ||
| { | ||
| $this->container = $container; | ||
| } | ||
| protected function inlineLink($Excerpt) | ||
| { | ||
| $retval = parent::inlineLink($Excerpt); | ||
| if (!is_array($retval)) { | ||
| return $retval; | ||
| } | ||
|
|
||
| $href = $retval['element']['attributes']['href']; | ||
| if (!is_string($href)) | ||
| { | ||
| return $retval; | ||
| } | ||
|
|
||
| echo $href; | ||
| if (!preg_match('!^wiki:(\d+)$!', $href, $matches)) | ||
| { | ||
| echo "Hello"; | ||
| return $retval; | ||
| } | ||
|
|
||
| $wiki_id = $matches[1]; | ||
|
|
||
| $href = $this->container['helper']->url->to( | ||
| 'WikiController', | ||
| 'detail', | ||
| array( | ||
| 'plugin' => 'wiki', | ||
| 'wiki_id' => $wiki_id, | ||
| 'project_id' => $this->container['helper']->url->request->getIntegerParam('project_id') | ||
| ), | ||
| 'wiki' | ||
| ); | ||
| $retval['element']['attributes']['href'] = $href; | ||
| return $retval; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,13 +15,11 @@ | |
| 'not_editable' => $not_editable, | ||
| )) ?> | ||
|
|
||
| <div class="sidebar-content"> | ||
| <div class="sidebar-content" style="margin-left: 1em; padding-left: 1em; border-left: 1px solid black"> | ||
| <div class="page-header"> | ||
| <h2><?=t($wikipage['title'])?></h2> | ||
| <?php if (!$not_editable): ?> | ||
| <?=$this->modal->medium('edit', t('Edit page'), 'WikiController', 'edit', array('plugin' => 'wiki', 'wiki_id' => $wikipage['id']))?> | ||
| <?=$this->helper->modal->confirm('trash-o', t('Remove page'), 'WikiController', 'confirm', array('plugin' => 'wiki', 'project_id' => $project['id'], 'wiki_id' => $wikipage['id']))?> | ||
| <button class="separator"> </button> | ||
| <?=$this->url->icon('window-restore', t('View Editions'), 'WikiController', 'editions', array('plugin' => 'wiki', 'project_id' => $project['id'], 'wiki_id' => $wikipage['id']))?> | ||
| <?php endif ?> | ||
| <?php if(isset($wikipage['parent_id'])): ?> | ||
|
|
@@ -34,6 +32,42 @@ | |
| <?php endif ?> | ||
| </div> | ||
|
|
||
| <div class="wikicontent"> | ||
| <div class="page-header"> | ||
| <h2><?=t($wikipage['title'])?></h2> | ||
| </div> | ||
| <?php if (!empty($wikipage['content'])): ?> | ||
| <article class="markdown"> | ||
| <?=$this->text->markdown($wikipage['content'])?> | ||
| </article> | ||
| <?php endif?> | ||
|
|
||
| <?php if (!$not_editable): ?> | ||
| <div class="page-header" style="margin-top: 5em;"> | ||
| <h2><?=t('Attachments')?></h2> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Headings shouldn't be empty. |
||
| </div> | ||
| <ul> | ||
| <?php | ||
| ini_set('display_errors', 1); | ||
| ini_set('display_startup_errors', 1); | ||
| error_reporting(E_ALL); | ||
| ?> | ||
| <?=$this->modal->medium('file', t('Attach a document'), 'WikiFileController', 'create', array('plugin' => 'wiki', 'wiki_id' => $wikipage['id'], 'project_id' => $wikipage['project_id']))?> | ||
| <?= $this->modal->medium('camera', t('Add a screenshot'), 'WikiFileController', 'screenshot', array('plugin' => 'wiki', 'wiki_id' => $wikipage['id'], 'project_id' => $wikipage['project_id'])) ?> | ||
| </ul> | ||
|
|
||
| <?php if (!empty($files) || !empty($images)): ?> | ||
| <?= $this->hook->render('template:task:show:before-attachments', array('wiki' => $wiki, 'project' => $project)) ?> | ||
| <?= $this->render('wiki:wiki_file/show', array( | ||
| 'wiki' => $wiki, | ||
| 'files' => $files, | ||
| 'images' => $images | ||
| )) ?> | ||
| <?php endif ?> | ||
| <?php endif ?> | ||
|
|
||
| <hr style="margin-top: 2em; margin-bottom: 2em;" /> | ||
|
|
||
| <div style="float:left"> | ||
| <ul class="panel" style="margin:0"> | ||
| <details open> | ||
|
|
@@ -51,8 +85,6 @@ | |
| </ul> | ||
| </div> | ||
|
|
||
| <div style="float:left"> </div> | ||
|
|
||
| <div class="sidebar" style="float:left;max-width:100%;padding:0"> | ||
| <ul class="panel" style="margin:0"> | ||
| <details open> | ||
|
|
@@ -78,40 +110,6 @@ | |
| </ul> | ||
| </div> | ||
|
|
||
| <div class="wikicontent"> | ||
| <br> | ||
| <?php if (!empty($wikipage['content'])): ?> | ||
| <div class="page-header"> | ||
| <h2><?=t('Content')?></h2> | ||
| </div> | ||
| <article class="markdown"> | ||
| <?=$this->text->markdown($wikipage['content'])?> | ||
| </article> | ||
| <?php endif?> | ||
|
|
||
| <?php if (!$not_editable): ?> | ||
| <div class="page-header"> | ||
| <h2><?=t('Attachments')?></h2> | ||
| </div> | ||
| <ul> | ||
| <?php | ||
| ini_set('display_errors', 1); | ||
| ini_set('display_startup_errors', 1); | ||
| error_reporting(E_ALL); | ||
| ?> | ||
| <?=$this->modal->medium('file', t('Attach a document'), 'WikiFileController', 'create', array('plugin' => 'wiki', 'wiki_id' => $wikipage['id'], 'project_id' => $wikipage['project_id']))?> | ||
| <?= $this->modal->medium('camera', t('Add a screenshot'), 'WikiFileController', 'screenshot', array('plugin' => 'wiki', 'wiki_id' => $wikipage['id'], 'project_id' => $wikipage['project_id'])) ?> | ||
| </ul> | ||
|
|
||
| <?php if (!empty($files) || !empty($images)): ?> | ||
| <?= $this->hook->render('template:task:show:before-attachments', array('wiki' => $wiki, 'project' => $project)) ?> | ||
| <?= $this->render('wiki:wiki_file/show', array( | ||
| 'wiki' => $wiki, | ||
| 'files' => $files, | ||
| 'images' => $images | ||
| )) ?> | ||
| <?php endif ?> | ||
| <?php endif ?> | ||
|
|
||
| </div> | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Headings shouldn't be empty.