-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from funktechno/dev
0.3.2 release
- Loading branch information
Showing
12 changed files
with
332 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
plugin=Wiki | ||
version=0.3.1 | ||
version=0.3.2 | ||
all: | ||
@ echo "Build archive for plugin ${plugin} version=${version}" | ||
@ git archive HEAD --prefix=${plugin}/ --format=zip -o ${plugin}-${version}.zip |
This file contains 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 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,120 @@ | ||
<?php | ||
|
||
namespace Kanboard\Plugin\Wiki\Model; | ||
|
||
use Kanboard\EventBuilder\BaseEventBuilder; | ||
use Kanboard\Event\CommentEvent; | ||
|
||
/** | ||
* Class WikiEventBuilder | ||
* | ||
* @package Kanboard\EventBuilder | ||
*/ | ||
class WikiEventBuilder extends BaseEventBuilder | ||
{ | ||
protected $wiki_id = 0; | ||
|
||
protected $title = ""; | ||
|
||
protected $projectId = 0; | ||
|
||
/** | ||
* Set wiki_id | ||
* | ||
* @param int $wiki_id | ||
* @return $this | ||
*/ | ||
public function withPageId($wiki_id) | ||
{ | ||
$this->wiki_id = $wiki_id; | ||
return $this; | ||
} | ||
/** | ||
* @param string $title | ||
* @param int $projectId | ||
* @return $this | ||
*/ | ||
public function withTitle($title, $projectId) | ||
{ | ||
$this->title = $title; | ||
$this->projectId = $projectId; | ||
return $this; | ||
} | ||
|
||
/** | ||
* Build event data | ||
* | ||
* @access public | ||
* @return CommentEvent|null | ||
*/ | ||
public function buildEvent() | ||
{ | ||
$wikiPage = $this->wiki->getWikipage($this->wiki_id); | ||
|
||
if (empty($wikiPage)) { | ||
return null; | ||
} | ||
|
||
return new CommentEvent(array( | ||
'wiki' => $wikiPage, | ||
'project' => $this->projectModel->getById($wikiPage['project_id']), | ||
)); | ||
} | ||
|
||
public function buildEventWiki($wikiPage) | ||
{ | ||
if (empty($wikiPage)) { | ||
return null; | ||
} | ||
|
||
return new CommentEvent(array( | ||
'wiki' => $wikiPage, | ||
'project' => $this->projectModel->getById($wikiPage['project_id']), | ||
)); | ||
} | ||
|
||
/** | ||
* Get event title with author | ||
* | ||
* @access public | ||
* @param string $author | ||
* @param string $eventName | ||
* @param array $eventData | ||
* @return string | ||
*/ | ||
public function buildTitleWithAuthor($author, $eventName, array $eventData) | ||
{ | ||
switch ($eventName) { | ||
case Wiki::EVENT_UPDATE: | ||
return e('%s updated a wikipage on the project #%d', $author, $eventData['project']['id']); | ||
case Wiki::EVENT_CREATE: | ||
return e('%s created a wikipage on the project #%d', $author, $eventData['project']['id']); | ||
case Wiki::EVENT_DELETE: | ||
return e('%s removed a wikipage on the project #%d', $author, $eventData['project']['id']); | ||
default: | ||
return ''; | ||
} | ||
} | ||
|
||
/** | ||
* Get event title without author | ||
* | ||
* @access public | ||
* @param string $eventName | ||
* @param array $eventData | ||
* @return string | ||
*/ | ||
public function buildTitleWithoutAuthor($eventName, array $eventData) | ||
{ | ||
switch ($eventName) { | ||
case Wiki::EVENT_CREATE: | ||
return e('New wikipage on project #%d', $eventData['project']['task_id']); | ||
case Wiki::EVENT_UPDATE: | ||
return e('wikipage updated on project #%d', $eventData['project']['task_id']); | ||
case Wiki::EVENT_DELETE: | ||
return e('wikipage removed on project #%d', $eventData['project']['task_id']); | ||
default: | ||
return ''; | ||
} | ||
} | ||
} |
This file contains 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,66 @@ | ||
<?php | ||
|
||
namespace Kanboard\Plugin\Wiki\Model; | ||
|
||
use Kanboard\Job\BaseJob; | ||
// use Kanboard\EventBuilder\CommentEventBuilder; | ||
// use Kanboard\Model\CommentModel; | ||
|
||
/** | ||
* Class WikiEventJob | ||
* | ||
* @package Kanboard\Job | ||
*/ | ||
class WikiEventJob extends BaseJob | ||
{ | ||
/** | ||
* Set job params | ||
* | ||
* @param int $wikiPageId | ||
* @param string $eventName | ||
* @return $this | ||
*/ | ||
public function withParams($wikiPageId, $eventName) | ||
{ | ||
$this->jobParams = array($wikiPageId, $eventName); | ||
return $this; | ||
} | ||
|
||
/** | ||
* Execute job | ||
* | ||
* @param int $wikiPageId | ||
* @param string $eventName | ||
*/ | ||
public function execute($title, $projectId, $wikiPage, $eventName) | ||
{ | ||
$event = WikiEventBuilder::getInstance($this->container) | ||
->withTitle($title, $projectId) | ||
->buildEventWiki($wikiPage); | ||
|
||
if ($event !== null) { | ||
$this->dispatcher->dispatch($eventName, $event); | ||
|
||
// if ($eventName === Wiki::EVENT_CREATE) { | ||
// $userMentionJob = $this->userMentionJob->withParams($event['comment']['comment'], Wiki::EVENT_USER_MENTION, $event); | ||
// $this->queueManager->push($userMentionJob); | ||
// } | ||
} | ||
} | ||
|
||
public function executeWithId($wikiPageId, $eventName) | ||
{ | ||
$event = WikiEventBuilder::getInstance($this->container) | ||
->withPageId($wikiPageId) | ||
->buildEvent(); | ||
|
||
if ($event !== null) { | ||
$this->dispatcher->dispatch($eventName, $event); | ||
|
||
// if ($eventName === Wiki::EVENT_CREATE) { | ||
// $userMentionJob = $this->userMentionJob->withParams($event['comment']['comment'], Wiki::EVENT_USER_MENTION, $event); | ||
// $this->queueManager->push($userMentionJob); | ||
// } | ||
} | ||
} | ||
} |
This file contains 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.