Skip to content

Commit

Permalink
Merge pull request concretecms#11892 from aembler/misc-fixes-011624
Browse files Browse the repository at this point in the history
Misc Fixes 1/16/24
  • Loading branch information
aembler authored Jan 22, 2024
2 parents 0bdf7a9 + 749e9f5 commit 120c627
Show file tree
Hide file tree
Showing 145 changed files with 1,512 additions and 1,332 deletions.
17 changes: 9 additions & 8 deletions build/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"production": "mix --production"
},
"devDependencies": {
"@concretecms/bedrock": "^1.4.12",
"@concretecms/bedrock": "1.4.14",
"cross-env": "^5.1.1",
"download": "~8.0.0",
"grunt": "^1.5.3",
Expand Down
8 changes: 5 additions & 3 deletions concrete/attributes/date_time/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,11 @@ public function createAttributeValueFromRequest()
case 'date':
case 'date_time':
default:
$dt = $this->app->make('helper/form/date_time');
/* @var \Concrete\Core\Form\Service\Widget\DateTime $dt */
$datetime = $dt->translate('value', $data, true);
// Start in the user's time zone.
$datetime = new \DateTime($data['value'], $dh->getTimezone('user'));
// Convert to system for saving:
$systemTimezone = $dh->getTimezone('system');
$datetime->setTimezone($systemTimezone); // See https://github.com/concretecms/concretecms/issues/11866
break;
}

Expand Down
2 changes: 1 addition & 1 deletion concrete/attributes/date_time/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
echo '<input type="date" class="ccm-input-text form-control" id="' . $view->field('value') . '" name="'. $view->field('value') .'" value="' . $value . '">';
break;
default:
$value = $date->formatCustom('Y-m-d H:i', $value);
$value = $date->formatCustom('Y-m-d\TH:i', $value, $date->getUserTimeZoneID());
echo '<input type="datetime-local" class="ccm-input-text form-control" id="' . $view->field('value') . '" name="'. $view->field('value') .'" value="' . $value . '">';
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// This is an entry point so it just includes the partial that includes everything else.
// That way if we want to include full support in our theme we just include the partial (rather
// than including the entry point because I think it's bad practice.)
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';
@import 'frontend/frontend';
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';

// Base styling
@import 'bootstrap/scss/accordion';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// This is an entry point so it just includes the partial that includes everything else.
// That way if we want to include full support in our theme we just include the partial (rather
// than including the entry point because I think it's bad practice.)
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';
@import 'frontend/frontend';
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';

@import 'sidebar/navigation';
@import 'avatar/avatar';
@import 'avatar/avatar-cropper';
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';
@import '../../cms/scss/variables';
@import 'plugins/inline';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
// This is an entry point so it just includes the partial that includes everything else.
// That way if we want to include full support in our theme we just include the partial (rather
// than including the entry point because I think it's bad practice.)

// Include the variables that we need. We don't need to include these if frontend/frontend is being
// included by another entrypoint that already has access to them.
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';
@import '../../cms/scss/variables';

@import 'frontend/frontend';
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
/* stylelint-disable selector-max-compound-selectors */

@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';
@import '../../../cms/scss/variables';

div.ccm-conversation-avatar {
left: 0;
margin-right: 10px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
// jQuery UI
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';

@import 'document-library';
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// This is an entry point so it just includes the partial that includes everything else.
// That way if we want to include full support in our theme we just include the partial (rather
// than including the entry point because I think it's bad practice.)
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';
@import 'frontend/frontend';
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';
@import 'variables';

@import 'magnific-popup';

div.ccm-lightbox-popup-white {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// This is an entry point so it just includes the partial that includes everything else.
// That way if we want to include full support in our theme we just include the partial (rather
// than including the entry point because I think it's bad practice.)
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';
@import 'frontend/frontend';
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';

// Navigation bar styling
div.ccm-block-top-navigation-bar {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';

@import 'profile';
@import 'directory';
10 changes: 1 addition & 9 deletions concrete/blocks/core_page_type_composer_control_output/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,4 @@
<?php
}
?>
<?php
} else { ?>

<div class="ccm-ui">
<div class="alert alert-warning">
<?=t('Deleted Page Type Composer Form Element (Block ID %s)')?>
</div>
</div>
<?php }
<?php }
15 changes: 2 additions & 13 deletions concrete/blocks/express_form/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,32 +423,21 @@ public function save($data)

// Add mode
if (isset($data['exFormID']) && $data['exFormID'] !== '') {
$form = $entityManager->find(Form::class, $data['exFormID']);
if ($form && isset($data['formName']) && $data['formName'] !== '') {
$entity = $form->getEntity();
$entity->setName($data['formName']);
$entityManager->persist($entity);
$entityManager->flush();
}
return parent::save($data);
} else {
$fieldSet = $this->getFormFieldSet();
if ($fieldSet) {
$form = $fieldSet->getForm();
$entity = $form->getEntity();
if (isset($data['formName']) && $data['formName'] !== '') {
$entity->setName($data['formName']);
}
$data['exFormID'] = $form->getId();
}

if ($this->exFormID === null) {
// Add block - totally new form. We have to publish it before it is live.
$entity->setIsPublished(true);
$entityManager->persist($entity);
$entityManager->flush();
}

$entityManager->persist($entity);
$entityManager->flush();
}

if (!$entity) {
Expand Down
1 change: 1 addition & 0 deletions concrete/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"symfony/event-dispatcher": "^5.2",
"symfony/messenger": "^5.2",
"symfony/serializer": "^5.2",
"symfony/service-contracts": "^2.5",
"symfony/yaml":"^4",
"scssphp/scssphp": "^1.4",
"doctrine/annotations": "^1.13.2",
Expand Down
6 changes: 3 additions & 3 deletions concrete/config/concrete.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*
* @var string
*/
'version' => '9.2.4',
'version_installed' => '9.2.4',
'version_db' => '20231207100748', // the key of the latest database migration
'version' => '9.2.5',
'version_installed' => '9.2.5',
'version_db' => '20240119210413', // the key of the latest database migration

/*
* Installation status
Expand Down
2 changes: 1 addition & 1 deletion concrete/controllers/backend/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function checkout($cID, $flag, $token)
break;
}

if ($this->request->query->has('redirect')) {
if ($this->request->query->has('redirect') && $this->request->query->get('redirect') && !$this->request->query->has('cID')) {
$redirectUrl = $this->app->make(ResolverManagerInterface::class)->resolve([$this->request->query->get('redirect')]);
}
return $this->buildRedirect($redirectUrl);
Expand Down
3 changes: 2 additions & 1 deletion concrete/controllers/dialog/file/bulk/properties.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Concrete\Core\Attribute\Category\CategoryInterface;
use Concrete\Core\Attribute\Category\CategoryService;
use Concrete\Core\Attribute\Key\Component\KeySelector\ControllerTrait as KeySelectorControllerTrait;
use Concrete\Core\Attribute\ObjectInterface;
use Concrete\Core\Error\ErrorList\ErrorList;
use Concrete\Core\File\EditResponse as FileEditResponse;
use Concrete\Core\File\File;
Expand Down Expand Up @@ -126,7 +127,7 @@ public function getCategory(): CategoryInterface
*
* @see \Concrete\Core\Attribute\Key\Component\KeySelector\ControllerTrait::canEditAttributeKey()
*/
public function canEditAttributeKey(int $akID): bool
public function canEditAttributeKey(int $akID, ObjectInterface $object): bool
{
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion concrete/controllers/dialog/file/properties.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Concrete\Core\Attribute\Category\CategoryService;
use Concrete\Core\Attribute\Category\FileCategory;
use Concrete\Core\Attribute\Key\Component\KeySelector\ControllerTrait;
use Concrete\Core\Attribute\ObjectInterface;
use Concrete\Core\Entity\Attribute\Key\Key;
use Concrete\Core\Error\ErrorList\ErrorList;
use Concrete\Core\File\EditResponse;
Expand Down Expand Up @@ -54,7 +55,7 @@ public function getCategory(): CategoryInterface
return $this->category;
}

public function canEditAttributeKey(int $akID): bool
public function canEditAttributeKey(int $akID, ObjectInterface $object): bool
{
return true;
}
Expand Down
30 changes: 12 additions & 18 deletions concrete/controllers/dialog/page/bulk/properties.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Concrete\Core\Attribute\Category\CategoryInterface;
use Concrete\Core\Attribute\Category\CategoryService;
use Concrete\Core\Attribute\Key\Component\KeySelector\ControllerTrait as KeySelectorControllerTrait;
use Concrete\Core\Attribute\ObjectInterface;
use Concrete\Core\Error\ErrorList\ErrorList;
use Concrete\Core\Filesystem\ElementManager;
use Concrete\Core\Page\EditResponse as PageEditResponse;
Expand Down Expand Up @@ -44,11 +45,6 @@ class Properties extends BackendInterfaceController
*/
protected $canEdit = false;

/**
* @var int[]
*/
protected $allowedEditAttributes = [];

public function __construct(CategoryService $attributeCategoryService)
{
parent::__construct();
Expand All @@ -67,7 +63,6 @@ public function on_start()
parent::on_start();

$this->populatePages();
$this->setupAllowedEditAttributes();
}

public function view()
Expand Down Expand Up @@ -126,9 +121,13 @@ public function getCategory(): CategoryInterface
*
* @see \Concrete\Core\Attribute\Key\Component\KeySelector\ControllerTrait::canEditAttributeKey()
*/
public function canEditAttributeKey(int $akID): bool
public function canEditAttributeKey(int $akID, ObjectInterface $object): bool
{
return in_array($akID, $this->allowedEditAttributes);
$attributeKey = $this->category->getAttributeKeyByID($akID);
$key = Key::getByHandle('edit_page_properties');
$key->setPermissionObject($object);
$assignment = $key->getMyAssignment();
return $assignment->canEditAttributeKey($attributeKey);
}

/**
Expand All @@ -138,7 +137,11 @@ public function canEditAttributeKey(int $akID): bool
*/
protected function canAccess()
{
return ($this->getAction() === 'getAttribute' || $this->canEdit) && count($this->allowedEditAttributes) > 0;
$checker = new Checker(Page::getByPath('/dashboard/sitemap/search'));
if ($checker->canViewPage()) {
return $this->getAction() === 'getAttribute' || $this->canEdit;
}
return false;
}

protected function populatePages(): void
Expand Down Expand Up @@ -167,13 +170,4 @@ protected function populatePages(): void
$this->canEdit = false;
}
}

protected function setupAllowedEditAttributes(): void
{
$pk = Key::getByHandle('edit_page_properties');
$assignment = $pk->getMyAssignment();
if ($assignment) {
$this->allowedEditAttributes = $assignment->getAttributesAllowedArray();
}
}
}
3 changes: 2 additions & 1 deletion concrete/controllers/dialog/site_type/attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Concrete\Core\Attribute\Category\CategoryInterface;
use Concrete\Core\Attribute\Category\CategoryService;
use Concrete\Core\Attribute\Key\Component\KeySelector\ControllerTrait as KeySelectorControllerTrait;
use Concrete\Core\Attribute\ObjectInterface;
use Concrete\Core\Entity\Site\Skeleton;
use Concrete\Core\Entity\Site\Type as SiteType;
use Concrete\Core\Error\ErrorList\ErrorList;
Expand Down Expand Up @@ -85,7 +86,7 @@ public function getCategory(): CategoryInterface
return $this->category;
}

public function canEditAttributeKey(int $akID): bool
public function canEditAttributeKey(int $akID, ObjectInterface $object): bool
{
return true;
}
Expand Down
Loading

0 comments on commit 120c627

Please sign in to comment.