Skip to content

Commit d563364

Browse files
committed
Merge branch 'develop' into 1.2
2 parents aaa69b1 + 604fbf5 commit d563364

File tree

109 files changed

+225
-31753
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+225
-31753
lines changed

config/cors.php

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Cross-Origin Resource Sharing (CORS) Configuration
8+
|--------------------------------------------------------------------------
9+
|
10+
| Here you may configure your settings for cross-origin resource sharing
11+
| or "CORS". This determines what cross-origin operations may execute
12+
| in web browsers. You are free to adjust these settings as needed.
13+
|
14+
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
15+
|
16+
*/
17+
18+
'paths' => [],
19+
20+
'allowed_methods' => ['*'],
21+
22+
'allowed_origins' => ['*'],
23+
24+
'allowed_origins_patterns' => [],
25+
26+
'allowed_headers' => ['*'],
27+
28+
'exposed_headers' => [],
29+
30+
'max_age' => 0,
31+
32+
'supports_credentials' => false,
33+
34+
];

config/mail.php

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535

3636
'mailers' => [
3737
'smtp' => [
38-
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
3938
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
4039
'password' => env('MAIL_PASSWORD'),
4140
'port' => env('MAIL_PORT', 587),

modules/backend/behaviors/RelationController.php

+2
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ protected function makeViewWidget()
669669
$config->showSorting = $this->getConfig('view[showSorting]', true);
670670
$config->defaultSort = $this->getConfig('view[defaultSort]');
671671
$config->recordsPerPage = $this->getConfig('view[recordsPerPage]');
672+
$config->showPageNumbers = $this->getConfig('view[showPageNumbers]', false);
672673
$config->showCheckboxes = $this->getConfig('view[showCheckboxes]', !$this->readOnly);
673674
$config->recordUrl = $this->getConfig('view[recordUrl]');
674675
$config->customViewPath = $this->getConfig('view[customViewPath]');
@@ -820,6 +821,7 @@ protected function makeManageWidget()
820821
$config->showSorting = $this->getConfig('manage[showSorting]', !$isPivot);
821822
$config->defaultSort = $this->getConfig('manage[defaultSort]');
822823
$config->recordsPerPage = $this->getConfig('manage[recordsPerPage]');
824+
$config->showPageNumbers = $this->getConfig('manage[showPageNumbers]', false);
823825
$config->noRecordsMessage = $this->getConfig('manage[noRecordsMessage]');
824826

825827
if ($this->viewMode === 'single') {

modules/backend/formwidgets/DatePicker.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,16 @@ public function prepareVars()
127127
$value = DateTimeHelper::makeCarbon($value, false);
128128

129129
if (!($value instanceof Carbon)) {
130-
throw new ApplicationException(sprintf('"%s" is not a valid date / time value.', $value));
130+
$this->vars['error'] = (sprintf('"%s" is not a valid date / time value.', $value));
131+
} else {
132+
if ($this->mode === 'date' && !$this->ignoreTimezone) {
133+
$backendTimeZone = \Backend\Models\Preference::get('timezone');
134+
$value->setTimezone($backendTimeZone);
135+
$value->setTime(0, 0, 0);
136+
$value->setTimezone(Config::get('app.timezone'));
137+
}
138+
$value = $value->toDateTimeString();
131139
}
132-
133-
if ($this->mode === 'date' && !$this->ignoreTimezone) {
134-
$backendTimeZone = \Backend\Models\Preference::get('timezone');
135-
$value->setTimezone($backendTimeZone);
136-
$value->setTime(0, 0, 0);
137-
$value->setTimezone(Config::get('app.timezone'));
138-
}
139-
$value = $value->toDateTimeString();
140140
}
141141

142142
// Disable the datepicker visually when readOnly is enabled

modules/backend/formwidgets/datepicker/partials/_datepicker.php

-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<p class="flash-message static error">
33
<?= e($error); ?></p>
44
</p>
5-
<?php return; ?>
65
<?php endif; ?>
76
<?php if ($this->previewMode): ?>
87
<div class="form-control"><?= Backend::dateTime($value, [
@@ -11,7 +10,6 @@
1110
'defaultValue' => $value
1211
]) ?></div>
1312
<?php else: ?>
14-
1513
<div
1614
id="<?= $this->getId() ?>"
1715
class="field-datepicker"

modules/backend/formwidgets/fileupload/assets/css/fileupload.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/backend/formwidgets/permissioneditor/assets/css/permissioneditor.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@
3737
.permissioneditor table tr:last-child td{border-bottom:none}
3838
.permissioneditor table tr:first-child th{padding-top:0}
3939
.permissioneditor table tr.disabled td.permission-name{color:#AAA}
40-
.permissioneditor table tr.last-section-row td{border-bottom:none}
40+
.permissioneditor table tr.last-section-row td{border-bottom:none}

modules/backend/formwidgets/permissioneditor/assets/less/permissioneditor.less

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
text-transform: uppercase;
4242
font-size: @font-size-base - 3;
4343
text-align: center;
44+
cursor: pointer;
4445
}
4546
}
4647

@@ -136,4 +137,4 @@
136137
}
137138
}
138139
}
139-
}
140+
}

modules/backend/widgets/Form.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ public function setFormValues($data = null)
354354
public function onRefresh()
355355
{
356356
$result = [];
357-
$saveData = $this->getSaveData();
357+
$saveData = $this->getSaveData(true);
358358

359359
/**
360360
* @event backend.form.beforeRefresh
@@ -1171,10 +1171,8 @@ protected function showFieldLabels($field)
11711171

11721172
/**
11731173
* Returns post data from a submitted form.
1174-
*
1175-
* @return array
11761174
*/
1177-
public function getSaveData()
1175+
public function getSaveData(bool $includeAllFields = false): array
11781176
{
11791177
$this->defineFormFields();
11801178
$this->applyFiltersFromModel();
@@ -1196,7 +1194,7 @@ public function getSaveData()
11961194
/*
11971195
* Disabled and hidden should be omitted from data set
11981196
*/
1199-
if ($field->disabled || $field->hidden) {
1197+
if (!$includeAllFields && ($field->disabled || $field->hidden)) {
12001198
continue;
12011199
}
12021200

modules/system/ServiceProvider.php

+20-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use BackendAuth;
77
use BackendMenu;
88
use Config;
9+
use DateInterval;
910
use Event;
1011
use Illuminate\Pagination\Paginator;
1112
use Illuminate\Support\Facades\Schema;
@@ -18,10 +19,12 @@
1819
use System\Classes\PluginManager;
1920
use System\Classes\SettingsManager;
2021
use System\Classes\UpdateManager;
22+
use System\Helpers\DateTime;
2123
use System\Models\EventLog;
2224
use System\Models\MailSetting;
2325
use System\Twig\Engine as TwigEngine;
2426
use SystemException;
27+
use Twig\Environment;
2528
use Validator;
2629
use View;
2730
use Winter\Storm\Router\Helper as RouterHelper;
@@ -199,8 +202,16 @@ protected function registerMarkupTags()
199202
'route' => 'route',
200203
'secure_url' => 'secure_url',
201204
'secure_asset' => 'secure_asset',
205+
'date' => [function (Environment $env, $value, $timezone = null) {
206+
if (!($value instanceof DateInterval)) {
207+
$value = DateTime::makeCarbon($value)->toDateTime();
208+
}
209+
210+
return twig_date_converter($env, $value, $timezone);
211+
}, 'options' => ['needs_environment' => true]],
202212

203213
// Classes
214+
'array_*' => ['Arr', '*'],
204215
'str_*' => ['Str', '*'],
205216
'url_*' => ['Url', '*'],
206217
'html_*' => ['Html', '*'],
@@ -219,6 +230,13 @@ protected function registerMarkupTags()
219230
'studly' => ['Str', 'studly'],
220231
'trans' => ['Lang', 'get'],
221232
'transchoice' => ['Lang', 'choice'],
233+
'date' => [function (Environment $env, $value, $format = null, $timezone = null) {
234+
if (!($value instanceof DateInterval)) {
235+
$value = DateTime::makeCarbon($value)->toDateTime();
236+
}
237+
238+
return twig_date_format_filter($env, $value, $format, $timezone);
239+
}, 'options' => ['needs_environment' => true]],
222240
'md' => function ($value) {
223241
return (is_string($value) && $value !== '') ? Markdown::parse($value) : '';
224242
},
@@ -315,7 +333,8 @@ protected function registerLogging()
315333
{
316334
Event::listen(\Illuminate\Log\Events\MessageLogged::class, function ($event) {
317335
if (EventLog::useLogging()) {
318-
EventLog::add($event->message, $event->level);
336+
$details = $event->context ?? null;
337+
EventLog::add($event->message, $event->level, $details);
319338
}
320339
});
321340
}
@@ -572,14 +591,9 @@ protected function registerAssetBundles()
572591
* Register asset bundles
573592
*/
574593
CombineAssets::registerCallback(function ($combiner) {
575-
$combiner->registerBundle('~/modules/system/assets/less/styles.less');
576-
$combiner->registerBundle('~/modules/system/assets/ui/storm.less');
577594
$combiner->registerBundle('~/modules/system/assets/ui/storm.js');
578-
$combiner->registerBundle('~/modules/system/assets/ui/icons.less');
579595
$combiner->registerBundle('~/modules/system/assets/js/framework.js');
580596
$combiner->registerBundle('~/modules/system/assets/js/framework.combined.js');
581-
$combiner->registerBundle('~/modules/system/assets/less/framework.extras.less');
582-
$combiner->registerBundle('~/modules/system/assets/less/snowboard.extras.less');
583597
});
584598
}
585599

0 commit comments

Comments
 (0)