Fix
This commit is contained in:
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<appinfo>
|
|
||||||
<id>deckflow</id>
|
|
||||||
<name>Deckflow</name>
|
|
||||||
<description>Automatische Workflows für Nextcloud Decks</description>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<author>Dein Name</author>
|
|
||||||
<license>GPL-3.0</license>
|
|
||||||
</appinfo>
|
|
25
appinfo/app.php
Normal file
25
appinfo/app.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
namespace OCA\Deckflow\AppInfo;
|
||||||
|
|
||||||
|
use OCP\AppFramework\App;
|
||||||
|
use OCP\IContainer;
|
||||||
|
use OCA\Deckflow\Controller\DeckflowController;
|
||||||
|
use OCA\Deckflow\Migrations\Version20250312000000; // Migration importieren
|
||||||
|
|
||||||
|
class Application extends App {
|
||||||
|
public function __construct(array $urlParams = []) {
|
||||||
|
parent::__construct('deckflow', $urlParams);
|
||||||
|
|
||||||
|
// Controller registrieren
|
||||||
|
$container = $this->getContainer();
|
||||||
|
$container->registerService('DeckflowController', function (IContainer $c) {
|
||||||
|
return new DeckflowController($c['AppName'], $c);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Migration ausführen
|
||||||
|
\OC::$server->getMigrationService()->registerMigration(Version20250312000000::class);
|
||||||
|
|
||||||
|
\OC::$server->getBackgroundJobManager()->add(new WorkflowJob());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
4
assets/js/deckflow.js
Normal file
4
assets/js/deckflow.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// deckflow.js
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
// JS für das Bearbeiten oder Löschen von Workflows
|
||||||
|
});
|
@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "deckflow/deckflow",
|
|
||||||
"description": "Automatische Workflows für Nextcloud Decks",
|
|
||||||
"type": "nextcloud-app",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"license": "GPL-3.0",
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Dein Name",
|
|
||||||
"email": "deine@email.de"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"require": {
|
|
||||||
"php": "^7.2",
|
|
||||||
"nextcloud/app-framework": "^1.0"
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Deckflow\\": "src/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
37
controller/DeckflowController.php
Normal file
37
controller/DeckflowController.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
namespace OCA\Deckflow\Controller;
|
||||||
|
|
||||||
|
use OCP\AppFramework\Controller;
|
||||||
|
use OCP\IRequest;
|
||||||
|
use OCA\Deckflow\WorkflowRepository;
|
||||||
|
use OCP\User\CurrentUser;
|
||||||
|
|
||||||
|
class DeckflowController extends Controller {
|
||||||
|
|
||||||
|
private $workflowRepo;
|
||||||
|
|
||||||
|
public function __construct($appName, IRequest $request) {
|
||||||
|
parent::__construct($appName, $request);
|
||||||
|
$this->workflowRepo = new WorkflowRepository();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zeigt alle Workflows des Benutzers an
|
||||||
|
public function getWorkflows() {
|
||||||
|
$user_id = \OC::$server->getUserManager()->getUser()->getUID();
|
||||||
|
$workflows = $this->workflowRepo->getWorkflowsForUser($user_id);
|
||||||
|
return $this->render('main.php', ['workflows' => $workflows]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Workflow erstellen
|
||||||
|
public function createWorkflow($deck_id, $source_stack_id, $target_stack_id) {
|
||||||
|
$user_id = \OC::$server->getUserManager()->getUser()->getUID();
|
||||||
|
$this->workflowRepo->createWorkflow($user_id, $deck_id, $source_stack_id, $target_stack_id);
|
||||||
|
return $this->getWorkflows();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Workflow löschen
|
||||||
|
public function deleteWorkflow($workflow_id) {
|
||||||
|
$this->workflowRepo->deleteWorkflow($workflow_id);
|
||||||
|
return $this->getWorkflows();
|
||||||
|
}
|
||||||
|
}
|
27
lib/Migrations/Version20250312000000.php
Normal file
27
lib/Migrations/Version20250312000000.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
namespace OCA\Deckflow\Migrations;
|
||||||
|
|
||||||
|
use OCP\Migration\ITransaction;
|
||||||
|
use OCP\Migration\IOutput;
|
||||||
|
|
||||||
|
class Version20250312000000 implements ITransaction {
|
||||||
|
|
||||||
|
public function execute(IOutput $output) {
|
||||||
|
// Erstelle die Workflow-Tabelle
|
||||||
|
$output->output('Erstelle die deckflow_workflows-Tabelle...');
|
||||||
|
|
||||||
|
$query = 'CREATE TABLE IF NOT EXISTS `*deckflow_workflows` (
|
||||||
|
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`user_id` VARCHAR(255) NOT NULL,
|
||||||
|
`deck_id` INT NOT NULL,
|
||||||
|
`source_stack_id` INT NOT NULL,
|
||||||
|
`target_stack_id` INT NOT NULL,
|
||||||
|
`created_at` DATETIME NOT NULL,
|
||||||
|
`last_run` DATETIME DEFAULT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;';
|
||||||
|
|
||||||
|
\OC::$server->getDatabaseConnection()->executeQuery($query);
|
||||||
|
|
||||||
|
$output->output('Migration abgeschlossen.');
|
||||||
|
}
|
||||||
|
}
|
18
lib/WorkflowJob.php
Normal file
18
lib/WorkflowJob.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
namespace OCA\Deckflow;
|
||||||
|
|
||||||
|
use OC\BackgroundJob\TimedJob;
|
||||||
|
use OCP\BackgroundJob\IJob;
|
||||||
|
|
||||||
|
class WorkflowJob extends TimedJob {
|
||||||
|
|
||||||
|
public function run($argument) {
|
||||||
|
// Hole überfällige Workflows und verschiebe Karten
|
||||||
|
$workflowRepo = new WorkflowRepository();
|
||||||
|
$overdueWorkflows = $workflowRepo->getOverdueWorkflows();
|
||||||
|
|
||||||
|
foreach ($overdueWorkflows as $workflow) {
|
||||||
|
$workflowRepo->moveCardToTargetStack($workflow['card_id'], $workflow['target_stack_id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
42
lib/WorkflowRepository.php
Normal file
42
lib/WorkflowRepository.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
namespace OCA\Deckflow;
|
||||||
|
|
||||||
|
use OCP\DB\DbWrapper\SimpleDatabase;
|
||||||
|
use OCP\DB\DB;
|
||||||
|
|
||||||
|
class WorkflowRepository {
|
||||||
|
|
||||||
|
private $db;
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
$this->db = DB::getConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alle Workflows eines Benutzers abrufen
|
||||||
|
public function getWorkflowsForUser($user_id) {
|
||||||
|
$query = 'SELECT * FROM *deckflow_workflows WHERE user_id = ?';
|
||||||
|
return $this->db->executeQuery($query, [$user_id])->fetchAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Workflow erstellen
|
||||||
|
public function createWorkflow($user_id, $deck_id, $source_stack_id, $target_stack_id) {
|
||||||
|
$query = 'INSERT INTO *deckflow_workflows (user_id, deck_id, source_stack_id, target_stack_id, created_at) VALUES (?, ?, ?, ?, ?)';
|
||||||
|
$this->db->executeQuery($query, [$user_id, $deck_id, $source_stack_id, $target_stack_id, date('Y-m-d H:i:s')]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Workflow löschen
|
||||||
|
public function deleteWorkflow($workflow_id) {
|
||||||
|
$query = 'DELETE FROM *deckflow_workflows WHERE id = ?';
|
||||||
|
$this->db->executeQuery($query, [$workflow_id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Workflows mit überfälligen Karten abrufen
|
||||||
|
public function getOverdueWorkflows() {
|
||||||
|
// Logik zum Abrufen überfälliger Karten
|
||||||
|
}
|
||||||
|
|
||||||
|
// Karte verschieben
|
||||||
|
public function moveCardToTargetStack($card_id, $target_stack_id) {
|
||||||
|
// Logik zum Verschieben von Karten
|
||||||
|
}
|
||||||
|
}
|
9
resources/css/style.css
Normal file
9
resources/css/style.css
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/* style.css */
|
||||||
|
form {
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
padding: 10px;
|
||||||
|
background-color: #007bff;
|
||||||
|
color: white;
|
||||||
|
}
|
@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Deckflow\BackgroundJob;
|
|
||||||
|
|
||||||
use OCP\AppFramework\Utility\ITimeFactory;
|
|
||||||
use OCP\BackgroundJob\TimedJob;
|
|
||||||
|
|
||||||
class WorkflowJob extends TimedJob
|
|
||||||
{
|
|
||||||
private $workflowMapper;
|
|
||||||
|
|
||||||
public function __construct(ITimeFactory $timeFactory, WorkflowMapper $workflowMapper)
|
|
||||||
{
|
|
||||||
parent::__construct($timeFactory);
|
|
||||||
$this->workflowMapper = $workflowMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function run($argument)
|
|
||||||
{
|
|
||||||
// Hier kommt die Logik für das Ausführen des Workflows hin
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Deckflow\Controller;
|
|
||||||
|
|
||||||
use OCP\IRequest;
|
|
||||||
use OCP\AppFramework\Controller;
|
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
|
||||||
|
|
||||||
class DeckflowController extends Controller
|
|
||||||
{
|
|
||||||
private $request;
|
|
||||||
|
|
||||||
public function __construct(IRequest $request)
|
|
||||||
{
|
|
||||||
$this->request = $request;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
return new TemplateResponse('deckflow', 'index');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function createWorkflow()
|
|
||||||
{
|
|
||||||
// Hier kommt die Logik für das Erstellen eines Workflows hin
|
|
||||||
}
|
|
||||||
|
|
||||||
public function editWorkflow()
|
|
||||||
{
|
|
||||||
// Hier kommt die Logik für das Bearbeiten eines Workflows hin
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
?php
|
|
||||||
|
|
||||||
namespace Deckflow\Db;
|
|
||||||
|
|
||||||
use OCP\AppFramework\Db\Mapper;
|
|
||||||
use Deckflow\Model\Workflow;
|
|
||||||
|
|
||||||
class WorkflowMapper extends Mapper
|
|
||||||
{
|
|
||||||
public function __construct(\OCP\IDBConnection $db)
|
|
||||||
{
|
|
||||||
parent::__construct($db, 'deckflow_workflows', Workflow::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findWorkflowsByUserId($userId)
|
|
||||||
{
|
|
||||||
$sql = 'SELECT * FROM deckflow_workflows WHERE user_id = ?';
|
|
||||||
return $this->findEntities($sql, [$userId]);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Deckflow\Model;
|
|
||||||
|
|
||||||
use OCP\AppFramework\Db\Entity;
|
|
||||||
|
|
||||||
class Workflow extends Entity
|
|
||||||
{
|
|
||||||
protected $id;
|
|
||||||
protected $userId;
|
|
||||||
protected $deckId;
|
|
||||||
protected $sourceStackId;
|
|
||||||
protected $targetStackId;
|
|
||||||
protected $createdAt;
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->addType('id', 'integer');
|
|
||||||
$this->addType('userId', 'string');
|
|
||||||
$this->addType('deckId', 'integer');
|
|
||||||
$this->addType('sourceStackId', 'integer');
|
|
||||||
$this->addType('targetStackId', 'integer');
|
|
||||||
$this->addType('createdAt', 'timestamp');
|
|
||||||
}
|
|
||||||
}
|
|
40
templates/main.php
Normal file
40
templates/main.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
|
|
||||||
|
$view = new TemplateResponse('deckflow', 'main');
|
||||||
|
$view->assign('workflows', $workflows);
|
||||||
|
|
||||||
|
echo $view->render();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Workflow-Setup-Formular -->
|
||||||
|
<form action="/apps/deckflow/create" method="POST">
|
||||||
|
<label for="deck_id">Deck auswählen:</label>
|
||||||
|
<select name="deck_id" id="deck_id">
|
||||||
|
<!-- Decks des Benutzers -->
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<label for="source_stack_id">Quellstapel auswählen:</label>
|
||||||
|
<select name="source_stack_id" id="source_stack_id">
|
||||||
|
<!-- Quellstapel des Decks -->
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<label for="target_stack_id">Zielstapel auswählen:</label>
|
||||||
|
<select name="target_stack_id" id="target_stack_id">
|
||||||
|
<!-- Zielstapel des Decks -->
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<button type="submit">Workflow erstellen</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<!-- Workflows anzeigen -->
|
||||||
|
<ul>
|
||||||
|
<?php foreach ($workflows as $workflow): ?>
|
||||||
|
<li>
|
||||||
|
Deck: <?php echo $workflow['deck_id']; ?>,
|
||||||
|
Quellstapel: <?php echo $workflow['source_stack_id']; ?>,
|
||||||
|
Zielstapel: <?php echo $workflow['target_stack_id']; ?>
|
||||||
|
<a href="/apps/deckflow/delete/<?php echo $workflow['id']; ?>">Löschen</a>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
Reference in New Issue
Block a user