Skip to content

Commit

Permalink
Merge pull request #1 from HitArrowLegend/patch-3
Browse files Browse the repository at this point in the history
Patch 3
  • Loading branch information
HitArrowLegend authored Apr 7, 2021
2 parents f037d0d + bcffa00 commit 9514eb0
Show file tree
Hide file tree
Showing 144 changed files with 1,187 additions and 382 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/utilities/library-switcher
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env php
<?php
/**
* Storm library switch for CI
*
* Switches the version of the Storm library being required through Composer. The only argument is the branch or tag
* to switch to.
*/
if (empty($argv[1])) {
echo 'You must provide a version to switch the library dependency to.';
echo "\n";
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/utilities/phpcs-pr
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env php
<?php
/**
* Run PHPCS tests against a PR.
*
* The only argument is for the PR's base branch, which is then compared to the HEAD of the PR to retrieve the list
* of changed files. The PHPCS tests are only run against these changed files, to speed up the tests.
*/
if (empty($argv[1])) {
echo 'You must provide a base branch to check this PR against.';
echo "\n";
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/utilities/phpcs-push
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env php
<?php
/**
* Run PHPCS tests against a push.
*
* The only argument is for the commit, which a list of changed files is retrieved from. The PHPCS tests are only run
* against these changed files, to speed up the tests.
*/
if (empty($argv[1])) {
echo 'You must provide a commit SHA to check.';
echo "\n";
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ Winter's mission is to show the world that web development is not rocket science

Instructions on how to install Winter can be found at the [installation guide](https://wintercms.com/docs/setup/installation).

### Quick start installation
### Quick Start Installation

For advanced users, run this in your terminal to install Winter from command line:

```shell
composer create-project wintercms/winter example.com "dev-develop"
```

If you plan on using a database, run this command:
If you plan on using a database, run this command inside the application directory.

```shell
php artisan winter:install
Expand Down
15 changes: 10 additions & 5 deletions config/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| WARNING! Do not use anything that is used for other information in your
| application. Example: If you are using redis for managing queues and / or
| sessions, you should NOT be using the EXACT SAME redis connection for the
| Cache store, as calling Cache::flush() will flush the entire redis store.
|
*/

'default' => 'file',
Expand All @@ -29,16 +34,16 @@
'stores' => [

'apc' => [
'driver' => 'apc'
'driver' => 'apc',
],

'array' => [
'driver' => 'array'
'driver' => 'array',
],

'database' => [
'driver' => 'database',
'table' => 'cache',
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],

Expand All @@ -59,7 +64,7 @@
],

'redis' => [
'driver' => 'redis',
'driver' => 'redis',
'connection' => 'default',
],

Expand Down
3 changes: 2 additions & 1 deletion config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

'sqlite' => [
'driver' => 'sqlite',
'database' => 'storage/database.sqlite',
'database' => base_path('storage/database.sqlite'),
'prefix' => '',
],

Expand Down Expand Up @@ -144,4 +144,5 @@
*/

'useConfigForTesting' => false,

];
5 changes: 4 additions & 1 deletion config/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@
|
*/

'from' => ['address' => '[email protected]', 'name' => 'Winter CMS'],
'from' => [
'address' => '[email protected]',
'name' => 'Winter CMS',
],

/*
|--------------------------------------------------------------------------
Expand Down
23 changes: 12 additions & 11 deletions config/queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,31 @@

'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'ttr' => 60,
'host' => 'localhost',
'queue' => 'default',
'ttr' => 60,
],

'sqs' => [
'driver' => 'sqs',
'key' => 'your-public-key',
'key' => 'your-public-key',
'secret' => 'your-secret-key',
'queue' => 'your-queue-url',
'queue' => 'your-queue-url',
'region' => 'us-east-1',
],

'iron' => [
'driver' => 'iron',
'host' => 'mq-aws-us-east-1.iron.io',
'token' => 'your-token',
'driver' => 'iron',
'host' => 'mq-aws-us-east-1.iron.io',
'token' => 'your-token',
'project' => 'your-project-id',
'queue' => 'your-queue-name',
'queue' => 'your-queue-name',
'encrypt' => true,
],

'redis' => [
'driver' => 'redis',
'queue' => 'default',
'queue' => 'default',
'expire' => 60,
],

Expand All @@ -86,7 +86,8 @@
*/

'failed' => [
'database' => 'mysql', 'table' => 'failed_jobs',
'database' => 'mysql',
'table' => 'failed_jobs',
],

];
2 changes: 1 addition & 1 deletion config/testing/cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,6 @@
|
*/

'enableCsrfProtection' => false
'enableCsrfProtection' => false,

];
13 changes: 7 additions & 6 deletions modules/backend/classes/NavigationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public function registerMenuItems($owner, array $definitions)
*/
public function registerOwnerAlias(string $owner, string $alias)
{
$this->aliases[$alias] = $owner;
$this->aliases[strtoupper($alias)] = strtoupper($owner);
}

/**
Expand Down Expand Up @@ -632,7 +632,7 @@ public function setContext($owner, $mainMenuItemCode, $sideMenuItemCode = null)
*/
public function setContextOwner($owner)
{
$this->contextOwner = $owner;
$this->contextOwner = strtoupper($owner);
}

/**
Expand Down Expand Up @@ -685,7 +685,7 @@ public function setContextSideMenu($sideMenuItemCode)
*/
public function isMainMenuItemActive($item)
{
return $this->getContextOwner() === $item->owner && $this->contextMainMenuItemCode === $item->code;
return $this->getContextOwner() === strtoupper($item->owner) && $this->contextMainMenuItemCode === $item->code;
}

/**
Expand Down Expand Up @@ -716,7 +716,7 @@ public function isSideMenuItemActive($item)
return true;
}

return $this->getContextOwner() === $item->owner && $this->contextSideMenuItemCode === $item->code;
return $this->getContextOwner() === strtoupper($item->owner) && $this->contextSideMenuItemCode === $item->code;
}

/**
Expand All @@ -741,7 +741,7 @@ public function registerContextSidenavPartial($owner, $mainMenuItemCode, $partia
*/
public function getContextSidenavPartial($owner, $mainMenuItemCode)
{
$owner = $this->aliases[$owner] ?? $owner;
$owner = $this->aliases[strtoupper($owner)] ?? $owner;
$key = $owner.$mainMenuItemCode;

return $this->contextSidenavPartials[$key] ?? null;
Expand Down Expand Up @@ -778,6 +778,7 @@ protected function filterItemPermissions($user, array $items)
*/
protected function makeItemKey($owner, $code)
{
return strtoupper($this->aliases[$owner] ?? $owner).'.'.strtoupper($code);
$owner = strtoupper($owner);
return ($this->aliases[$owner] ?? $owner) . '.' . strtoupper($code);
}
}
26 changes: 21 additions & 5 deletions modules/backend/formwidgets/RecordFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ public function init()
throw new ApplicationException(Lang::get('backend::lang.recordfinder.invalid_model_class', ['modelClass' => $this->modelClass]));
}

$modelKey = $this->getRecordModel()->getKeyName();
if ($this->keyFrom === 'id' && $modelKey !== 'id') {
$this->keyFrom = $modelKey;
}

if (post('recordfinder_flag')) {
$this->listWidget = $this->makeListWidget();
$this->listWidget->bindToController();
Expand Down Expand Up @@ -302,16 +307,27 @@ public function onFindRecord()
return $this->makePartial('recordfinder_form');
}

protected function makeListWidget()
/**
* Gets the base model instance used by this field
*
* @return \Winter\Storm\Database\Model
*/
protected function getRecordModel()
{
$config = $this->makeConfig($this->getConfig('list'));

$model = null;
if ($this->useRelation) {
$config->model = $this->getRelationModel();
$model = $this->getRelationModel();
} else {
$config->model = new $this->modelClass;
$model = new $this->modelClass;
}
return $model;
}

protected function makeListWidget()
{
$config = $this->makeConfig($this->getConfig('list'));

$config->model = $this->getRecordModel();
$config->alias = $this->alias . 'List';
$config->showSetup = false;
$config->showCheckboxes = false;
Expand Down
26 changes: 20 additions & 6 deletions modules/backend/formwidgets/taglist/partials/_taglist.htm
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
<?php
$selectedValues = is_array($selectedValues) ? $selectedValues : [];
$availableOptions = $useKey ? $fieldOptions : array_unique(array_merge($selectedValues, $fieldOptions));
$displayOnlyOptions = [];

foreach ($availableOptions as $key => $option) {
if (!strlen($option)) {
continue;
}
if (($useKey && in_array($key, $selectedValues)) || (!$useKey && in_array($option, $selectedValues))) {
$displayOnlyOptions[] = $option;
}
}
?>
<!-- Tag List -->
<?php if ($this->previewMode || $field->readOnly || $field->disabled): ?>
<ul class="form-control taglist--preview" <?= $field->readOnly || $field->disabled ? 'disabled="disabled"' : ''; ?>>
<?php foreach ($availableOptions as $key => $option): ?>
<?php if (!strlen($option)) continue ?>
<?php if (($useKey && in_array($key, $selectedValues)) || (!$useKey && in_array($option, $selectedValues))): ?>
<li class="taglist__item"><?= e(trans($option)) ?></li>
<?php endif ?>
<?php foreach ($displayOnlyOptions as $option): ?>
<li class="taglist__item"><?= e(trans($option)) ?></li>
<?php endforeach ?>
</ul>
<?php if ($field->readOnly): ?>
<?php if ($field->readOnly && is_array($field->value)): ?>
<?php foreach ($displayOnlyOptions as $option): ?>
<input
type="hidden"
name="<?= $field->getName() ?>[]"
value="<?= $option ?>">
<?php endforeach ?>
<?php else: ?>
<input
type="hidden"
name="<?= $field->getName() ?>"
Expand Down
6 changes: 5 additions & 1 deletion modules/backend/lang/be/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,10 @@
'selection_mode' => "Рэжым выбару",
'resize_image' => "Змяніць памер",
'image_size' => "Памер выявы:",
'selected_size' => "Выбрана:"
'selected_size' => "Выбрана:",
'rename_popup_title' => "Пераіменаваць",
'rename_new_name' => "Новае імя",
'move_please_select' => "калі ласка, выберыце",
'move_button' => "Перамясціць",
]
];
6 changes: 5 additions & 1 deletion modules/backend/lang/bg/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,10 @@
'selection_mode' => 'Режимът на избиране (селекция)',
'resize_image' => 'Преоразмеряване изображение',
'image_size' => 'Размер на изображение:',
'selected_size' => 'Избран:'
'selected_size' => 'Избран:',
'rename_popup_title' => 'Преименувай',
'rename_new_name' => 'Ново име',
'move_please_select' => 'Моля изберете',
'move_button' => 'Премести',
]
];
6 changes: 5 additions & 1 deletion modules/backend/lang/ca/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,10 @@
'selection_mode' => 'Selecciona mode',
'resize_image' => 'Redimensionar imatge',
'image_size' => "Mida d'imatge:",
'selected_size' => 'Seleccionat:'
'selected_size' => 'Seleccionat:',
'rename_popup_title' => 'Reanomenar',
'rename_new_name' => 'Nou nom',
'move_please_select' => 'si us plau selecciona',
'move_button' => 'Moure',
],
];
6 changes: 5 additions & 1 deletion modules/backend/lang/cs/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,10 @@
'selection_mode' => 'Způsob označování (selection mode)',
'resize_image' => 'Změnit velikost obrázku',
'image_size' => 'Velikost obrázku:',
'selected_size' => 'Vybráno:'
'selected_size' => 'Vybráno:',
'rename_popup_title' => 'Přejmenovat',
'rename_new_name' => 'Nový název',
'move_please_select' => 'prosím vyberte',
'move_button' => 'Přesunout',
],
];
6 changes: 5 additions & 1 deletion modules/backend/lang/da/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,10 @@
'selection_mode' => 'Udvælgelsesmetode',
'resize_image' => 'Skaler billede',
'image_size' => 'Billedstørrelse:',
'selected_size' => 'Valgt:'
'selected_size' => 'Valgt:',
'rename_popup_title' => 'Omdøb',
'rename_new_name' => 'Nyt navn',
'move_please_select' => 'Vælg venligst',
'move_button' => 'Flyt',
]
];
6 changes: 5 additions & 1 deletion modules/backend/lang/de/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,10 @@
'selection_mode' => 'Auswahlmodus',
'resize_image' => 'Bildgröße anpassen',
'image_size' => 'Dimensionen:',
'selected_size' => 'Ausgewählt:'
'selected_size' => 'Ausgewählt:',
'rename_popup_title' => 'Umbenennen',
'rename_new_name' => 'Neuer Name',
'move_please_select' => 'Bitte auswählen',
'move_button' => 'Verschieben',
]
];
Loading

0 comments on commit 9514eb0

Please sign in to comment.