Skip to content

Commit

Permalink
Merge branch 'develop' into 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeTowers committed Apr 26, 2024
2 parents aaa69b1 + 604fbf5 commit d563364
Show file tree
Hide file tree
Showing 109 changed files with 225 additions and 31,753 deletions.
34 changes: 34 additions & 0 deletions config/cors.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/

'paths' => [],

'allowed_methods' => ['*'],

'allowed_origins' => ['*'],

'allowed_origins_patterns' => [],

'allowed_headers' => ['*'],

'exposed_headers' => [],

'max_age' => 0,

'supports_credentials' => false,

];
1 change: 0 additions & 1 deletion config/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

'mailers' => [
'smtp' => [
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'password' => env('MAIL_PASSWORD'),
'port' => env('MAIL_PORT', 587),
Expand Down
2 changes: 2 additions & 0 deletions modules/backend/behaviors/RelationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ protected function makeViewWidget()
$config->showSorting = $this->getConfig('view[showSorting]', true);
$config->defaultSort = $this->getConfig('view[defaultSort]');
$config->recordsPerPage = $this->getConfig('view[recordsPerPage]');
$config->showPageNumbers = $this->getConfig('view[showPageNumbers]', false);
$config->showCheckboxes = $this->getConfig('view[showCheckboxes]', !$this->readOnly);
$config->recordUrl = $this->getConfig('view[recordUrl]');
$config->customViewPath = $this->getConfig('view[customViewPath]');
Expand Down Expand Up @@ -820,6 +821,7 @@ protected function makeManageWidget()
$config->showSorting = $this->getConfig('manage[showSorting]', !$isPivot);
$config->defaultSort = $this->getConfig('manage[defaultSort]');
$config->recordsPerPage = $this->getConfig('manage[recordsPerPage]');
$config->showPageNumbers = $this->getConfig('manage[showPageNumbers]', false);
$config->noRecordsMessage = $this->getConfig('manage[noRecordsMessage]');

if ($this->viewMode === 'single') {
Expand Down
18 changes: 9 additions & 9 deletions modules/backend/formwidgets/DatePicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,16 @@ public function prepareVars()
$value = DateTimeHelper::makeCarbon($value, false);

if (!($value instanceof Carbon)) {
throw new ApplicationException(sprintf('"%s" is not a valid date / time value.', $value));
$this->vars['error'] = (sprintf('"%s" is not a valid date / time value.', $value));
} else {
if ($this->mode === 'date' && !$this->ignoreTimezone) {
$backendTimeZone = \Backend\Models\Preference::get('timezone');
$value->setTimezone($backendTimeZone);
$value->setTime(0, 0, 0);
$value->setTimezone(Config::get('app.timezone'));
}
$value = $value->toDateTimeString();
}

if ($this->mode === 'date' && !$this->ignoreTimezone) {
$backendTimeZone = \Backend\Models\Preference::get('timezone');
$value->setTimezone($backendTimeZone);
$value->setTime(0, 0, 0);
$value->setTimezone(Config::get('app.timezone'));
}
$value = $value->toDateTimeString();
}

// Disable the datepicker visually when readOnly is enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<p class="flash-message static error">
<?= e($error); ?></p>
</p>
<?php return; ?>
<?php endif; ?>
<?php if ($this->previewMode): ?>
<div class="form-control"><?= Backend::dateTime($value, [
Expand All @@ -11,7 +10,6 @@
'defaultValue' => $value
]) ?></div>
<?php else: ?>

<div
id="<?= $this->getId() ?>"
class="field-datepicker"
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
.permissioneditor table tr:last-child td{border-bottom:none}
.permissioneditor table tr:first-child th{padding-top:0}
.permissioneditor table tr.disabled td.permission-name{color:#AAA}
.permissioneditor table tr.last-section-row td{border-bottom:none}
.permissioneditor table tr.last-section-row td{border-bottom:none}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
text-transform: uppercase;
font-size: @font-size-base - 3;
text-align: center;
cursor: pointer;
}
}

Expand Down Expand Up @@ -136,4 +137,4 @@
}
}
}
}
}
8 changes: 3 additions & 5 deletions modules/backend/widgets/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public function setFormValues($data = null)
public function onRefresh()
{
$result = [];
$saveData = $this->getSaveData();
$saveData = $this->getSaveData(true);

/**
* @event backend.form.beforeRefresh
Expand Down Expand Up @@ -1171,10 +1171,8 @@ protected function showFieldLabels($field)

/**
* Returns post data from a submitted form.
*
* @return array
*/
public function getSaveData()
public function getSaveData(bool $includeAllFields = false): array
{
$this->defineFormFields();
$this->applyFiltersFromModel();
Expand All @@ -1196,7 +1194,7 @@ public function getSaveData()
/*
* Disabled and hidden should be omitted from data set
*/
if ($field->disabled || $field->hidden) {
if (!$includeAllFields && ($field->disabled || $field->hidden)) {
continue;
}

Expand Down
26 changes: 20 additions & 6 deletions modules/system/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use BackendAuth;
use BackendMenu;
use Config;
use DateInterval;
use Event;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Schema;
Expand All @@ -18,10 +19,12 @@
use System\Classes\PluginManager;
use System\Classes\SettingsManager;
use System\Classes\UpdateManager;
use System\Helpers\DateTime;
use System\Models\EventLog;
use System\Models\MailSetting;
use System\Twig\Engine as TwigEngine;
use SystemException;
use Twig\Environment;
use Validator;
use View;
use Winter\Storm\Router\Helper as RouterHelper;
Expand Down Expand Up @@ -199,8 +202,16 @@ protected function registerMarkupTags()
'route' => 'route',
'secure_url' => 'secure_url',
'secure_asset' => 'secure_asset',
'date' => [function (Environment $env, $value, $timezone = null) {
if (!($value instanceof DateInterval)) {
$value = DateTime::makeCarbon($value)->toDateTime();
}

return twig_date_converter($env, $value, $timezone);
}, 'options' => ['needs_environment' => true]],

// Classes
'array_*' => ['Arr', '*'],
'str_*' => ['Str', '*'],
'url_*' => ['Url', '*'],
'html_*' => ['Html', '*'],
Expand All @@ -219,6 +230,13 @@ protected function registerMarkupTags()
'studly' => ['Str', 'studly'],
'trans' => ['Lang', 'get'],
'transchoice' => ['Lang', 'choice'],
'date' => [function (Environment $env, $value, $format = null, $timezone = null) {
if (!($value instanceof DateInterval)) {
$value = DateTime::makeCarbon($value)->toDateTime();
}

return twig_date_format_filter($env, $value, $format, $timezone);
}, 'options' => ['needs_environment' => true]],
'md' => function ($value) {
return (is_string($value) && $value !== '') ? Markdown::parse($value) : '';
},
Expand Down Expand Up @@ -315,7 +333,8 @@ protected function registerLogging()
{
Event::listen(\Illuminate\Log\Events\MessageLogged::class, function ($event) {
if (EventLog::useLogging()) {
EventLog::add($event->message, $event->level);
$details = $event->context ?? null;
EventLog::add($event->message, $event->level, $details);
}
});
}
Expand Down Expand Up @@ -572,14 +591,9 @@ protected function registerAssetBundles()
* Register asset bundles
*/
CombineAssets::registerCallback(function ($combiner) {
$combiner->registerBundle('~/modules/system/assets/less/styles.less');
$combiner->registerBundle('~/modules/system/assets/ui/storm.less');
$combiner->registerBundle('~/modules/system/assets/ui/storm.js');
$combiner->registerBundle('~/modules/system/assets/ui/icons.less');
$combiner->registerBundle('~/modules/system/assets/js/framework.js');
$combiner->registerBundle('~/modules/system/assets/js/framework.combined.js');
$combiner->registerBundle('~/modules/system/assets/less/framework.extras.less');
$combiner->registerBundle('~/modules/system/assets/less/snowboard.extras.less');
});
}

Expand Down
Loading

0 comments on commit d563364

Please sign in to comment.