Integrations hardening -- Set up dimmed off RecoReco/FinanceBuddy; honest Disable (v0.6.0)

This commit is contained in:
2026-07-11 15:58:15 -03:00
parent 2fff0af063
commit 374517496a
4 changed files with 41 additions and 21 deletions

View File

@@ -1,28 +1,36 @@
<?php
// QualKard is inside the shared Integrations form, so the buttons use formaction (NOT nested <form>s)
// to post to QualKard's own controller. Set up is destructive; disabling only stops the automation.
$has = $this->QualKardHelper->hasRecoReco();
$fb = $this->QualKardHelper->fbEnabled($project['id']);
$enabled = $this->QualKardHelper->isEnabled($project['id']);
$blocked = ! $has || $fb;
?>
<h3><i class="fa fa-graduation-cap fa-fw" aria-hidden="true"></i> <?= t('QualKard') ?></h3>
<div class="listing">
<?php if (! $this->QualKardHelper->hasRecoReco()): ?>
<?php if ($enabled): ?>
<p class="form-help"><?= t('QualKard needs the RecoReco plugin (its move engine). Install RecoReco to use QualKard.') ?></p>
<?php elseif (! $this->QualKardHelper->isEnabled($project['id'])): ?>
<p class="form-help"><?= t('Turn this project into a spaced-repetition study board. This restructures the columns to Drafts | Study | Hairy | Hard | Medium | Easy | Done and moves every card to Drafts.') ?></p>
<form method="post" action="<?= $this->url->href('QualKardController', 'setup', array('plugin' => 'QualKard', 'project_id' => $project['id'])) ?>" onsubmit="return confirm('<?= t('This restructures the board and moves all cards to Drafts. Continue?') ?>');">
<?= $this->form->csrf() ?>
<button type="submit" class="btn btn-blue"><?= t('Set up QualKard study board') ?></button>
</form>
<p class="form-help"><?= t('QualKard is enabled on this board.') ?></p>
<div class="form-actions">
<button type="submit" class="btn" formaction="<?= $this->url->href('QualKardController', 'reset', array('plugin' => 'QualKard', 'project_id' => $project['id'])) ?>" onclick="return confirm('<?= t('Reset every card to unread and move them to Drafts. Continue?') ?>');"><?= t('Reset all cards') ?></button>
<button type="submit" class="btn btn-red" formaction="<?= $this->url->href('QualKardController', 'disable', array('plugin' => 'QualKard', 'project_id' => $project['id'])) ?>"><?= t('Disable QualKard machinery') ?></button>
</div>
<p class="form-help"><?= t('"Disable" only stops the QualKard automation -- it does not restructure the board or touch your cards.') ?></p>
<?php else: ?>
<p class="form-help"><?= t('QualKard is enabled on this board.') ?></p>
<form method="post" style="display:inline" action="<?= $this->url->href('QualKardController', 'reset', array('plugin' => 'QualKard', 'project_id' => $project['id'])) ?>" onsubmit="return confirm('<?= t('Reset every card to unread and move them to Drafts. Continue?') ?>');">
<?= $this->form->csrf() ?>
<button type="submit" class="btn"><?= t('Reset all cards') ?></button>
</form>
<form method="post" style="display:inline" action="<?= $this->url->href('QualKardController', 'disable', array('plugin' => 'QualKard', 'project_id' => $project['id'])) ?>">
<?= $this->form->csrf() ?>
<button type="submit" class="btn btn-red"><?= t('Disable QualKard') ?></button>
</form>
<p class="form-help">
<?php if (! $has): ?>
<?= t('QualKard needs the RecoReco plugin (its move engine).') ?>
<?php elseif ($fb): ?>
<?= t('Disabled while FinanceBuddy is enabled here -- QualKard would restructure the columns.') ?>
<?php else: ?>
<?= t('Set up turns this project into a study board: columns become Drafts | Study | Hairy | Hard | Medium | Easy | Done and every card moves to Drafts.') ?>
<?php endif ?>
</p>
<div class="form-actions"<?= $blocked ? ' style="opacity:0.5"' : '' ?>>
<button type="submit" class="btn btn-blue" <?= $blocked ? 'disabled="disabled"' : '' ?> formaction="<?= $this->url->href('QualKardController', 'setup', array('plugin' => 'QualKard', 'project_id' => $project['id'])) ?>" onclick="return confirm('<?= t('This restructures the board and moves all cards to Drafts. Continue?') ?>');"><?= t('Set up QualKard study board') ?></button>
</div>
<?php endif ?>
</div>