看板初始化提交

This commit is contained in:
zephyr
2026-06-01 21:23:12 -07:00
commit 54a842f4ab
2104 changed files with 241695 additions and 0 deletions
@@ -0,0 +1,13 @@
<?php
namespace Kanboard\Core\ExternalTask;
/**
* Class AccessForbiddenException
*
* @package Kanboard\Core\ExternalTask
* @author Frederic Guillot
*/
class AccessForbiddenException extends ExternalTaskException
{
}
@@ -0,0 +1,15 @@
<?php
namespace Kanboard\Core\ExternalTask;
use Exception;
/**
* Class NotFoundException
*
* @package Kanboard\Core\ExternalTask
* @author Frederic Guillot
*/
class ExternalTaskException extends Exception
{
}
@@ -0,0 +1,26 @@
<?php
namespace Kanboard\Core\ExternalTask;
/**
* Interface ExternalTaskInterface
*
* @package Kanboard\Core\ExternalTask
* @author Frederic Guillot
*/
interface ExternalTaskInterface
{
/**
* Return Uniform Resource Identifier for the task
*
* @return string
*/
public function getUri();
/**
* Return a dict to populate the task form
*
* @return array
*/
public function getFormValues();
}
@@ -0,0 +1,68 @@
<?php
namespace Kanboard\Core\ExternalTask;
/**
* Class ExternalTaskManager
*
* @package Kanboard\Core\ExternalTask
* @author Frederic Guillot
*/
class ExternalTaskManager
{
protected $providers = array();
/**
* Register a new task provider
*
* @param ExternalTaskProviderInterface $externalTaskProvider
* @return $this
*/
public function register(ExternalTaskProviderInterface $externalTaskProvider)
{
$this->providers[$externalTaskProvider->getName()] = $externalTaskProvider;
return $this;
}
/**
* Get task provider
*
* @param string $name
* @return ExternalTaskProviderInterface|null
* @throws ProviderNotFoundException
*/
public function getProvider($name)
{
if (isset($this->providers[$name])) {
return $this->providers[$name];
}
throw new ProviderNotFoundException('Unable to load this provider: '.$name);
}
/**
* Get list of task providers
*
* @return array
*/
public function getProvidersList()
{
$providers = array_keys($this->providers);
if (count($providers)) {
return array_combine($providers, $providers);
}
return array();
}
/**
* Get all providers
*
* @return ExternalTaskProviderInterface[]
*/
public function getProviders()
{
return $this->providers;
}
}
@@ -0,0 +1,94 @@
<?php
namespace Kanboard\Core\ExternalTask;
/**
* Interface ExternalTaskProviderInterface
*
* @package Kanboard\Core\ExternalTask
* @author Frederic Guillot
*/
interface ExternalTaskProviderInterface
{
/**
* Get provider name (visible in the user interface)
*
* @access public
* @return string
*/
public function getName();
/**
* Get provider icon
*
* @access public
* @return string
*/
public function getIcon();
/**
* Get label for adding a new task
*
* @access public
* @return string
*/
public function getMenuAddLabel();
/**
* Retrieve task from external system or cache
*
* @access public
* @throws \Kanboard\Core\ExternalTask\ExternalTaskException
* @param string $uri
* @param int $projectID
* @return ExternalTaskInterface
*/
public function fetch($uri, $projectID);
/**
* Save external task to another system
*
* @throws \Kanboard\Core\ExternalTask\ExternalTaskException
* @param string $uri
* @param array $formValues
* @param array $formErrors
* @return bool
*/
public function save($uri, array $formValues, array &$formErrors);
/**
* Get task import template name
*
* @return string
*/
public function getImportFormTemplate();
/**
* Get creation form template
*
* @return string
*/
public function getCreationFormTemplate();
/**
* Get modification form template
*
* @return string
*/
public function getModificationFormTemplate();
/**
* Get task view template name
*
* @return string
*/
public function getViewTemplate();
/**
* Build external task URI based on import form values
*
* @param array $formValues
* @return string
*/
public function buildTaskUri(array $formValues);
}
@@ -0,0 +1,13 @@
<?php
namespace Kanboard\Core\ExternalTask;
/**
* Class NotFoundException
*
* @package Kanboard\Core\ExternalTask
* @author Frederic Guillot
*/
class NotFoundException extends ExternalTaskException
{
}
@@ -0,0 +1,13 @@
<?php
namespace Kanboard\Core\ExternalTask;
/**
* Class ProviderNotFoundException
*
* @package Kanboard\Core\ExternalTask
* @author Frederic Guillot
*/
class ProviderNotFoundException extends ExternalTaskException
{
}