Skip to content
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

Features/improve boards #11700

Merged
merged 9 commits into from Oct 13, 2023
13 changes: 5 additions & 8 deletions concrete/controllers/dialog/board/custom_slot.php
Expand Up @@ -6,11 +6,7 @@
use Concrete\Core\Block\View\BlockView;
use Concrete\Core\Board\Command\AddCustomSlotToBoardCommand;
use Concrete\Core\Board\Helper\Traits\SlotTemplateJsonHelperTrait;
use Concrete\Core\Board\Instance\Slot\Content\AvailableObjectCollectionFactory;
use Concrete\Core\Board\Instance\Slot\Content\ContentPopulator;
use Concrete\Core\Board\Instance\Slot\Content\ContentRenderer;
use Concrete\Core\Board\Instance\Slot\Content\ObjectCollection;
use Concrete\Core\Board\Instance\Slot\Template\AvailableTemplateCollectionFactory;
use Concrete\Core\Entity\Board\Instance;
use Concrete\Core\Entity\Board\InstanceItem;
use Concrete\Core\Entity\Board\SlotTemplate;
Expand All @@ -20,6 +16,8 @@
use Doctrine\ORM\EntityManager;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use \Concrete\Core\Board\Instance\Slot\Planner\SlotFilterer;
use \Concrete\Core\Board\Instance\Slot\Planner\PlannedInstance;

class CustomSlot extends \Concrete\Core\Controller\Controller
{
Expand Down Expand Up @@ -56,7 +54,6 @@ public function getTemplates()
{
$entityManager = $this->app->make(EntityManager::class);
$contentPopulator = $this->app->make(ContentPopulator::class);
$availableTemplateCollectionFactory = $this->app->make(AvailableTemplateCollectionFactory::class);

$instance = $this->getInstanceFromRequest();
$items = [];
Expand All @@ -65,9 +62,9 @@ public function getTemplates()
$items[] = $entityManager->find(InstanceItem::class, $itemId);
}
}
$templates = $availableTemplateCollectionFactory->getAvailableTemplates(
$instance, $this->request->request->get('slot')
);

$plannedInstance = new PlannedInstance($instance, $items);
$templates = $this->app->make(SlotFilterer::class)->getPotentialSlotTemplates($plannedInstance, $this->request->request->get('slot'));

$itemObjectGroups = $contentPopulator->createContentObjects($items);
return new JsonResponse($this->createSlotTemplateJsonArray($templates, $itemObjectGroups));
Expand Down
58 changes: 33 additions & 25 deletions concrete/single_pages/dashboard/boards/add.php
Expand Up @@ -7,62 +7,70 @@
*/
?>

<form method="post" action="<?=$view->action('submit')?>">
<?=$token->output('submit')?>
<form method="post" action="<?= $view->action('submit') ?>">
<?= $token->output('submit') ?>
<fieldset>
<div class="form-group">
<?=$form->label('boardName', t('Board Name'))?>
<?=$form->text('boardName')?>
<?= $form->label('boardName', t('Board Name')) ?>
<?= $form->text('boardName') ?>
</div>

<div class="form-group">
<?=$form->label('boardName', t('Template'))?>
<?=$form->select('templateID', $templates)?>
<?= $form->label('boardName', t('Template')) ?>
<?= $form->select('templateID', $templates) ?>
</div>

<div class="form-group">
<label class="control-label form-label"><?=t('Sort By')?></label>
<label class="control-label form-label">
<?= t('Sort By') ?>
</label>

<div class="form-check">
<?=$form->radio('sortBy', 'relevant_date_asc', true)?>
<label class="form-check-label" for="sortBy1">
<?=t('Ascending Date.') . ' '. t('(Only items from the future)')?>
<?= $form->radio('sortBy', 'relevant_date_desc', true) ?>
<label class="form-check-label" for="sortBy2">
<?= t('Descending Date.') . ' ' . t('(Only items from the past)') ?>
</label>
</div>

<div class="form-check">
<?=$form->radio('sortBy', 'relevant_date_desc')?>
<label class="form-check-label" for="sortBy2">
<?=t('Descending Date.') . ' '. t('(Only items from the past)')?>
<?= $form->radio('sortBy', 'relevant_date_asc') ?>
<label class="form-check-label" for="sortBy1">
<?= t('Ascending Date.') . ' ' . t('(Only items from the future)') ?>
</label>
</div>
</div>

<?php if ($multisite) { ?>
<div class="form-group">
<label class="control-label form-label"><?=t('Site')?></label>

<label class="control-label form-label">
<?= t('Site') ?>
</label>

<div class="form-check">
<?=$form->radio('sharedBoard', 0)?>
<?= $form->radio('sharedBoard', 0) ?>
<label class="form-check-label" for="sharedBoard1">
<?=t('Add to current site.')?>
<?= t('Add to current site.') ?>
</label>
</div>

<div class="form-check">
<?=$form->radio('sharedBoard', 1)?>
<?= $form->radio('sharedBoard', 1) ?>
<label class="form-check-label" for="sharedBoard2">
<?=t('Share board with all sites.')?>
<?= t('Share board with all sites.') ?>
</label>
</div>
</div>
<?php } ?>

<div class="ccm-dashboard-form-actions-wrapper">
<div class="ccm-dashboard-form-actions ">
<a href="<?=$view->url('/dashboard/boards/boards')?>" class="btn btn-secondary float-start"><?=t("Cancel")?></a>
<button type="submit" class="btn btn-primary float-end"><?=$buttonText?></button>
<a href="<?= $view->url('/dashboard/boards/boards') ?>" class="btn btn-secondary float-start">
<?= t("Cancel") ?>
</a>
<button type="submit" class="btn btn-primary float-end">
<?= $buttonText ?>
</button>
</div>
</div>
</fieldset>
</form>
</form>
75 changes: 44 additions & 31 deletions concrete/single_pages/dashboard/boards/edit.php
Expand Up @@ -15,62 +15,71 @@
?>
</div>
<div class="col-8">
<form method="post" action="<?=$view->action('submit', $board->getBoardID())?>">
<?=$token->output('submit')?>
<form method="post" action="<?= $view->action('submit', $board->getBoardID()) ?>">
<?= $token->output('submit') ?>
<fieldset>
<div class="form-group">
<?=$form->label('boardName', t('Board Name'))?>
<?=$form->text('boardName', $boardName)?>
<?= $form->label('boardName', t('Board Name')) ?>
<?= $form->text('boardName', $boardName) ?>
</div>

<div class="form-group">
<?=$form->label('templateID', t('Template'))?>
<?=$form->select('templateID', $templates, $templateID)?>
<?= $form->label('templateID', t('Template')) ?>
<?= $form->select('templateID', $templates, $templateID) ?>
</div>

<div class="form-group">
<label class="control-label form-label"><?=t('Sort By')?></label>
<label class="control-label form-label">
<?= t('Sort By') ?>
</label>

<div class="form-check">
<?=$form->radio('sortBy', 'relevant_date_asc', $sortBy)?>
<label class="form-check-label" for="sortBy1">
<?=t('Ascending Date.') . ' '. t('(Only items from the future)')?>
<?= $form->radio('sortBy', 'relevant_date_desc', $sortBy) ?>
<label class="form-check-label" for="sortBy2">
<?= t('Descending Date.') . ' ' . t('(Only items from the past)') ?>
</label>
</div>

<div class="form-check">
<?=$form->radio('sortBy', 'relevant_date_desc', $sortBy)?>
<label class="form-check-label" for="sortBy2">
<?=t('Descending Date.') . ' '. t('(Only items from the past)')?>
<?= $form->radio('sortBy', 'relevant_date_asc', $sortBy) ?>
<label class="form-check-label" for="sortBy1">
<?= t('Ascending Date.') . ' ' . t('(Only items from the future)') ?>
</label>
</div>
</div>


<?php if ($multisite) { ?>
<div class="form-group">
<label class="control-label form-label"><?=t('Site')?></label>
<label class="control-label form-label">
<?= t('Site') ?>
</label>

<div class="form-check">
<?=$form->radio('sharedBoard', 0, $isSharedBoard)?>
<?= $form->radio('sharedBoard', 0, $isSharedBoard) ?>
<label class="form-check-label" for="sharedBoard1">
<?=t('Add to current site.')?>
<?= t('Add to current site.') ?>
</label>
</div>

<div class="form-check">
<?=$form->radio('sharedBoard', 1, $isSharedBoard)?>
<?= $form->radio('sharedBoard', 1, $isSharedBoard) ?>
<label class="form-check-label" for="sharedBoard2">
<?=t('Share board with all sites.')?>
<?= t('Share board with all sites.') ?>
</label>
</div>
</div>
<?php } ?>

<div class="ccm-dashboard-form-actions-wrapper">
<div class="ccm-dashboard-form-actions ">
<button type="button" class="btn btn-danger float-start" data-bs-toggle="modal" data-bs-target="#delete-board"><?=t("Delete")?></button>
<button type="submit" class="btn btn-primary float-end"><?=t('Save')?></button>
<button type="button" class="btn btn-danger float-start" data-bs-toggle="modal"
data-bs-target="#delete-board">
<?= t("Delete") ?>
</button>
<button type="submit" class="btn btn-primary float-end">
<?= t('Save') ?>
</button>
</div>
</div>
</fieldset>
Expand All @@ -80,25 +89,29 @@
</div>

<div class="modal fade" id="delete-board" tabindex="-1">
<form method="post" action="<?=$view->action('delete_board', $board->getBoardID())?>">
<?=$token->output('delete_board')?>
<form method="post" action="<?= $view->action('delete_board', $board->getBoardID()) ?>">
<?= $token->output('delete_board') ?>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><?=t('Delete Board')?></h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="<?= t('Close') ?>"></button>
<h5 class="modal-title">
<?= t('Delete Board') ?>
</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"
aria-label="<?= t('Close') ?>"></button>
</div>
<div class="modal-body">
<?=t('Are you sure you want to remove this board?')?>
<?= t('Are you sure you want to remove this board?') ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary me-auto" data-bs-dismiss="modal"><?=t('Cancel')?></button>
<button type="submit" class="btn btn-danger float-end"><?=t('Delete Board')?></button>
<button type="button" class="btn btn-secondary me-auto" data-bs-dismiss="modal">
<?= t('Cancel') ?>
</button>
<button type="submit" class="btn btn-danger float-end">
<?= t('Delete Board') ?>
</button>
</div>
</div>
</div>
</form>
</div>



</div>
Expand Up @@ -3,7 +3,6 @@
namespace Concrete\Core\Board\Command;

use Concrete\Core\Application\Application;
use Concrete\Core\Entity\Board\InstanceItemBatch;
use Doctrine\ORM\EntityManager;

class AddContentToBoardInstanceCommandHandler
Expand Down
1 change: 0 additions & 1 deletion concrete/src/Board/Command/BoardDetailsTrait.php
Expand Up @@ -2,7 +2,6 @@

namespace Concrete\Core\Board\Command;

use Concrete\Core\Entity\Board\Board;
use Concrete\Core\Entity\Board\Template;
use Concrete\Core\Entity\Site\Site;

Expand Down
Expand Up @@ -3,7 +3,6 @@
namespace Concrete\Core\Board\Command;

use Concrete\Core\Entity\Board\InstanceItem;
use Concrete\Core\Entity\Board\InstanceItemBatch;
use Doctrine\ORM\EntityManager;

class ClearBoardInstanceCommandHandler
Expand Down
Expand Up @@ -2,8 +2,6 @@

namespace Concrete\Core\Board\Command;

use Concrete\Core\Entity\Board\Board;
use Concrete\Core\Entity\Board\Instance;
use Concrete\Core\Logging\Channels;
use Concrete\Core\Logging\LoggerFactory;
use Doctrine\ORM\EntityManager;
Expand Down
Expand Up @@ -3,7 +3,6 @@
namespace Concrete\Core\Board\Command;

use Concrete\Core\Entity\Board\Board;
use Concrete\Core\Entity\Board\SlotTemplate;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\EntityManager;

Expand Down
Expand Up @@ -2,7 +2,6 @@

namespace Concrete\Core\Board\Command;

use Concrete\Core\Board\Instance\Item\Populator\PopulatorInterface;
use Concrete\Core\Entity\Board\InstanceItem;
use Concrete\Core\Entity\Board\InstanceItemBatch;
use Concrete\Core\Logging\Channels;
Expand Down
Expand Up @@ -2,14 +2,10 @@

namespace Concrete\Core\Board\Command;

use Concrete\Core\Entity\Board\Instance;
use Concrete\Core\Entity\Board\InstanceSlotRule;
use Concrete\Core\Localization\Service\Date;
use Concrete\Core\Logging\Channels;
use Concrete\Core\Logging\LoggerFactory;
use Concrete\Core\User\User;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Id\UuidGenerator;

class ScheduleBoardInstanceRuleCommandHandler
{
Expand Down
Expand Up @@ -2,7 +2,6 @@

namespace Concrete\Core\Board\Command;

use Concrete\Core\Entity\Board\DataSource\ConfiguredDataSource;
use Doctrine\ORM\EntityManager;

class SetBoardCustomWeightingCommandHandler
Expand Down
1 change: 0 additions & 1 deletion concrete/src/Board/Command/UpdateBoardCommandHandler.php
Expand Up @@ -2,7 +2,6 @@

namespace Concrete\Core\Board\Command;

use Concrete\Core\Entity\Board\Board;
use Doctrine\ORM\EntityManager;

class UpdateBoardCommandHandler
Expand Down
1 change: 0 additions & 1 deletion concrete/src/Board/DataSource/Saver/CalendarEventSaver.php
Expand Up @@ -3,7 +3,6 @@

use Concrete\Core\Entity\Board\DataSource\Configuration\CalendarEventConfiguration;
use Concrete\Core\Entity\Board\DataSource\Configuration\Configuration;
use Concrete\Core\Entity\Board\DataSource\ConfiguredDataSource;
use Concrete\Core\Entity\Calendar\Calendar;
use Concrete\Core\Entity\Search\Query;
use Concrete\Core\Calendar\Event\Search\Field\Manager;
Expand Down
1 change: 0 additions & 1 deletion concrete/src/Board/DataSource/Saver/PageSaver.php
Expand Up @@ -3,7 +3,6 @@

use Concrete\Core\Entity\Board\DataSource\Configuration\Configuration;
use Concrete\Core\Entity\Board\DataSource\Configuration\PageConfiguration;
use Concrete\Core\Entity\Board\DataSource\ConfiguredDataSource;
use Concrete\Core\Entity\Search\Query;
use Concrete\Core\Page\Search\Field\Manager;
use Doctrine\ORM\EntityManager;
Expand Down
2 changes: 0 additions & 2 deletions concrete/src/Board/DataSource/Saver/SaverInterface.php
Expand Up @@ -2,12 +2,10 @@

namespace Concrete\Core\Board\DataSource\Saver;

use Concrete\Core\Application\UserInterface\Icon\IconFormatterInterface;
use Concrete\Core\Entity\Board\Board;
use Concrete\Core\Entity\Board\DataSource\Configuration\Configuration;
use Concrete\Core\Entity\Board\DataSource\ConfiguredDataSource;
use Concrete\Core\Entity\Board\DataSource\DataSource;
use Concrete\Core\Filesystem\Element;
use Symfony\Component\HttpFoundation\Request;

defined('C5_EXECUTE') or die("Access Denied.");
Expand Down
Expand Up @@ -2,8 +2,6 @@

namespace Concrete\Core\Board\Designer\Command;

use Concrete\Core\Entity\Board\Board;
use Concrete\Core\Entity\Board\Designer\CustomElement;
use Concrete\Core\Entity\Board\Designer\ItemSelectorCustomElement;
use Concrete\Core\User\User;
use Doctrine\ORM\EntityManager;
Expand Down
Expand Up @@ -2,7 +2,6 @@

namespace Concrete\Core\Board\Designer\Command;

use Concrete\Core\Entity\Board\Designer\CustomElementItem;
use Concrete\Core\Entity\Board\Designer\ItemSelectorCustomElementItem;
use Doctrine\ORM\EntityManager;

Expand Down