Commit ee68dbd4 authored by Aster's avatar Aster Committed by waltermazza
Browse files

General Bug Fixes and Improvements

parent c889e94d
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
- Add field notify_category in table news_categorie, enable/disable the notification of news of certain type of news
- Add possibility to create a category that is visible only on a specific community
### Added
- New property in AmosModule that can be used by modules that will enhance it to allow the translation plugin to take the configurations of the fields of the db
...@@ -7,31 +7,31 @@ You need to require this package and enable the module in your configuration. ...@@ -7,31 +7,31 @@ You need to require this package and enable the module in your configuration.
add to composer requirements in composer.json add to composer requirements in composer.json
``` ```
"arter/amos-news": "dev-master", "elitedivision/amos-news": "dev-master",
``` ```
or run command bash: or run command bash:
```bash ```bash
composer require "arter/amos-news:dev-master" composer require "elitedivision/amos-news:dev-master"
``` ```
Enable the News modules in modules-amos.php, add : Enable the News modules in modules-amos.php, add :
```php ```php
'news' => [ 'news' => [
'class' => 'arter\amos\news\AmosNews', 'class' => 'elitedivision\amos\news\AmosNews',
], ],
``` ```
add news migrations to console modules (console/config/migrations-amos.php): add news migrations to console modules (console/config/migrations-amos.php):
``` ```
'@vendor/arter/amos-news/src/migrations' '@vendor/elitedivision/amos-news/src/migrations'
``` ```
If a frontend or a public site are used in your project and news need to be visible outside backend, enable form/wizard fields to allow publication in frontend/home page with params: If a frontend or a public site are used in your project and news need to be visible outside backend, enable form/wizard fields to allow publication in frontend/home page with params:
```php ```php
'news' => [ 'news' => [
'class' => 'arter\amos\news\AmosNews', 'class' => 'elitedivision\amos\news\AmosNews',
'params' => [ 'params' => [
'site_publish_enabled' => true, 'site_publish_enabled' => true,
'site_featured_enabled' => true 'site_featured_enabled' => true
...@@ -47,19 +47,21 @@ To do so: ...@@ -47,19 +47,21 @@ To do so:
- search for news in content configuration section - search for news in content configuration section
- edit configuration of news and save - edit configuration of news and save
If tags are needed enable this module in "modules-amos.php" (backend/config folder in main project) in tag section. After that, enable the trees in tag manager. If tags are needed enable this module in "modules-amos.php" (backend/config folder in main project) in tag section.
After that, enable the trees in tag manager.
If platform uses report and/or comments and you want to enable News to be commented/to report a content, add the model to the configuration in modules-amos.php: If platform uses report and/or comments and you want to enable News to be commented/to report a content,
add the model to the configuration in modules-amos.php:
for reports: for reports:
``` ```
'report' => [ 'report' => [
'class' => 'arter\amos\report\AmosReport', 'class' => 'elitedivision\amos\report\AmosReport',
'modelsEnabled' => [ 'modelsEnabled' => [
. .
. .
'arter\amos\news\models\News', //line to add 'elitedivision\amos\news\models\News', //line to add
. .
. .
] ]
...@@ -71,11 +73,11 @@ for comments: ...@@ -71,11 +73,11 @@ for comments:
``` ```
'comments' => [ 'comments' => [
'class' => 'arter\amos\comments\AmosComments', 'class' => 'elitedivision\amos\comments\AmosComments',
'modelsEnabled' => [ 'modelsEnabled' => [
. .
. .
'arter\amos\news\models\News', //line to add 'elitedivision\amos\news\models\News', //line to add
. .
. .
], ],
...@@ -90,7 +92,7 @@ If some property default is not suitable for your project, you can configure it ...@@ -90,7 +92,7 @@ If some property default is not suitable for your project, you can configure it
```php ```php
'news' => [ 'news' => [
'class' => 'arter\amos\news\AmosNews', 'class' => 'elitedivision\amos\news\AmosNews',
'validatePublicationDate' => false, //changed property (default was true) 'validatePublicationDate' => false, //changed property (default was true)
], ],
``` ```
...@@ -103,11 +105,12 @@ Set to false to allow validation for news with publication_date less than TODAY. ...@@ -103,11 +105,12 @@ Set to false to allow validation for news with publication_date less than TODAY.
* **filterCategoriesByRole** - boolean, default = false * **filterCategoriesByRole** - boolean, default = false
If true, enables category role check via table news_category_roles_mm. If true, enables category role check via table news_category_roles_mm.
By default news category are available to all users. By default news category are available to all users.
In case categories are in association with rbac roles, populate table 'news_category_roles_mm' and set to true the Module property filterCategoriesByRole in configurations: In case categories are in association with rbac roles, populate table 'news_category_roles_mm'
and set to true the Module property filterCategoriesByRole in configurations:
```php ```php
'news' => [ 'news' => [
'class' => 'arter\amos\news\AmosNews', 'class' => 'elitedivision\amos\news\AmosNews',
'filterCategoriesByRole' => true 'filterCategoriesByRole' => true
] ]
``` ```
...@@ -120,7 +123,7 @@ Mandatory fields in news form: by default news category, title and status are ma ...@@ -120,7 +123,7 @@ Mandatory fields in news form: by default news category, title and status are ma
If in your platform, for example, you don't want title to be a mandatory field, overwrite newsRequiredFields property as below: If in your platform, for example, you don't want title to be a mandatory field, overwrite newsRequiredFields property as below:
```php ```php
'news' => [ 'news' => [
'class' => 'arter\amos\news\AmosNews', 'class' => 'elitedivision\amos\news\AmosNews',
'newsRequiredFields' => ['news_categorie_id', 'status'] 'newsRequiredFields' => ['news_categorie_id', 'status']
], ],
``` ```
...@@ -129,7 +132,7 @@ If in your platform, for example, you don't want title to be a mandatory field, ...@@ -129,7 +132,7 @@ If in your platform, for example, you don't want title to be a mandatory field,
The ID of the default category pre-selected for the new News The ID of the default category pre-selected for the new News
```php ```php
'news' => [ 'news' => [
'class' => 'arter\amos\news\AmosNews', 'class' => 'elitedivision\amos\news\AmosNews',
'defaultCategory' => 3 'defaultCategory' => 3
], ],
``` ```
...@@ -137,7 +140,13 @@ The ID of the default category pre-selected for the new News ...@@ -137,7 +140,13 @@ The ID of the default category pre-selected for the new News
This set the auto update of the publication date on the save if the news is published This set the auto update of the publication date on the save if the news is published
```php ```php
'news' => [ 'news' => [
'class' => 'arter\amos\news\AmosNews', 'class' => 'elitedivision\amos\news\AmosNews',
'autoUpdatePublicationDate' => true 'autoUpdatePublicationDate' => true
], ],
``` ```
* **$enableCategoriesForCommunity** - boolean, default = false
* **$showAllCategoriesForCommunity** - boolean, default = false
* **$whiteListRolesCategories** - default = ['ADMIN', 'BASIC_USER']
{ {
"name": "arter/amos-news", "name": "elitedivision/amos-news",
"description": "Sistema AMOS per le news", "description": "Sistema AMOS per le news",
"keywords": ["amos", "yii2", "news"], "keywords": ["amos", "yii2", "news"],
"homepage": "http://www.arter.it/", "homepage": "http://www.elitedivision.it/",
"type": "component", "type": "component",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"support": { "support": {
"issues": "http://www.example.com/", "issues": "http://www.example.com/",
"forum": "http://www.example.com/forum/", "forum": "http://www.example.com/forum/",
"wiki": "http://www.example.com/wiki/", "wiki": "http://www.example.com/wiki/",
"source": "https://github.com/arter/amos-news" "source": "https://github.com/elitedivision/amos-news"
}, },
"require": { "require": {
"php": ">=5.4.0", "php": ">=5.4.0",
"2amigos/yii2-ckeditor-widget": "~1.0", "2amigos/yii2-ckeditor-widget": "~1.0",
"cornernote/yii2-workflow-manager": "*", "cornernote/yii2-workflow-manager": "*",
"arter/amos-admin":"^2.2.0", "elitedivision/amos-admin":"^2.2.0",
"arter/amos-attachments": "^1.1.11", "elitedivision/amos-attachments": "^1.1.11",
"arter/amos-comments":"^1.1", "elitedivision/amos-comments":"^1.1",
"arter/amos-core":"^1.15.0", "elitedivision/amos-core":"^1.15.0",
"arter/amos-dashboard":"^1.8.4", "elitedivision/amos-dashboard":"^1.8.4",
"arter/amos-notify":"^1.4.13", "elitedivision/amos-notify":"^1.4.13",
"arter/amos-report":"^1.0.5", "elitedivision/amos-report":"^1.0.5",
"arter/amos-workflow": "^1.0.5", "elitedivision/amos-workflow": "^1.0.5",
"arter/amos-seo": "*", "elitedivision/amos-seo": "*",
"raoul2000/yii2-workflow": "*", "raoul2000/yii2-workflow": "*",
"raoul2000/yii2-workflow-view": "*", "raoul2000/yii2-workflow-view": "*",
"yiidoc/yii2-redactor": "*", "yiidoc/yii2-redactor": "*",
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"arter\\amos\\news\\": "src" "elitedivision\\amos\\news\\": "src"
} }
}, },
"require-dev": { "require-dev": {
......
<?php <?php
/** /**
* Copyright 2020 Art-ER S. Cons. P.A. * Lombardia Informatica S.p.A.
* EROI - Emilia Romagna Open Innovation is based on: * OPEN 2.0
* https://www.open2.0.regione.lombardia.it
* *
* @see http://example.com Developers'community * @see http://example.com Developers'community
* @license GPLv3 * @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 * @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package arter\amos\news * @package elitedivision\amos\news
* @category CategoryName * @category CategoryName
* @author Elite Division S.r.l. * @author Lombardia Informatica S.p.A.
*/ */
namespace arter\amos\news; namespace elitedivision\amos\news;
use arter\amos\core\interfaces\CmsModuleInterface; use elitedivision\amos\core\interfaces\CmsModuleInterface;
use arter\amos\core\interfaces\SearchModuleInterface; use elitedivision\amos\core\interfaces\SearchModuleInterface;
use arter\amos\core\module\AmosModule; use elitedivision\amos\core\module\AmosModule;
use arter\amos\core\module\ModuleInterface; use elitedivision\amos\core\module\ModuleInterface;
use arter\amos\news\widgets\graphics\WidgetGraphicsUltimeNews; use elitedivision\amos\news\widgets\graphics\WidgetGraphicsUltimeNews;
use arter\amos\news\widgets\icons\WidgetIconAllNews; use elitedivision\amos\news\widgets\icons\WidgetIconAllNews;
use arter\amos\news\widgets\icons\WidgetIconNews; use elitedivision\amos\news\widgets\icons\WidgetIconNews;
use arter\amos\news\widgets\icons\WidgetIconNewsCategorie; use elitedivision\amos\news\widgets\icons\WidgetIconNewsCategorie;
use arter\amos\news\widgets\icons\WidgetIconNewsCreatedBy; use elitedivision\amos\news\widgets\icons\WidgetIconNewsCreatedBy;
use arter\amos\news\widgets\icons\WidgetIconNewsDashboard; use elitedivision\amos\news\widgets\icons\WidgetIconNewsDashboard;
use arter\amos\news\widgets\icons\WidgetIconNewsDaValidare; use elitedivision\amos\news\widgets\icons\WidgetIconNewsDaValidare;
use yii\helpers\ArrayHelper; use yii\helpers\ArrayHelper;
/** /**
* Class AmosNews * Class AmosNews
* @package arter\amos\news * @package elitedivision\amos\news
*/ */
class AmosNews extends AmosModule implements ModuleInterface, SearchModuleInterface, CmsModuleInterface { class AmosNews extends AmosModule implements ModuleInterface, SearchModuleInterface, CmsModuleInterface {
...@@ -137,11 +137,11 @@ class AmosNews extends AmosModule implements ModuleInterface, SearchModuleInterf ...@@ -137,11 +137,11 @@ class AmosNews extends AmosModule implements ModuleInterface, SearchModuleInterf
* @var array * @var array
*/ */
public $viewPathEmailSummary = [ public $viewPathEmailSummary = [
'arter\amos\news\models\News' => '@vendor/arter/amos-news/src/views/email/notify_summary' 'elitedivision\amos\news\models\News' => '@vendor/elitedivision/amos-news/src/views/email/notify_summary'
]; ];
public $viewPathEmailSummaryNetwork = [ public $viewPathEmailSummaryNetwork = [
'arter\amos\news\models\News' => '@vendor/arter/amos-news/src/views/email/notify_summary_network' 'elitedivision\amos\news\models\News' => '@vendor/elitedivision/amos-news/src/views/email/notify_summary_network'
]; ];
/* /*
* @var bool disableStandardWorkflow Disable standard worflow, direct publish * @var bool disableStandardWorkflow Disable standard worflow, direct publish
...@@ -189,7 +189,7 @@ class AmosNews extends AmosModule implements ModuleInterface, SearchModuleInterf ...@@ -189,7 +189,7 @@ class AmosNews extends AmosModule implements ModuleInterface, SearchModuleInterf
public function init() { public function init() {
parent::init(); parent::init();
\Yii::setAlias('@arter/amos/' . static::getModuleName() . '/controllers', __DIR__ . '/controllers'); \Yii::setAlias('@elitedivision/amos/' . static::getModuleName() . '/controllers', __DIR__ . '/controllers');
//Configuration: merge default module configurations loaded from config.php with module configurations set by the application //Configuration: merge default module configurations loaded from config.php with module configurations set by the application
$config = require(__DIR__ . DIRECTORY_SEPARATOR . self::$CONFIG_FOLDER . DIRECTORY_SEPARATOR . 'config.php'); $config = require(__DIR__ . DIRECTORY_SEPARATOR . self::$CONFIG_FOLDER . DIRECTORY_SEPARATOR . 'config.php');
......
<?php <?php
/** /**
* Copyright 2020 Art-ER S. Cons. P.A. * Lombardia Informatica S.p.A.
* EROI - Emilia Romagna Open Innovation is based on: * OPEN 2.0
* https://www.open2.0.regione.lombardia.it
* *
* @see http://example.com Developers'community * @see http://example.com Developers'community
* @license GPLv3 * @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 * @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package arter\amos\news * @package elitedivision\amos\news
* @category CategoryName * @category CategoryName
* @author Elite Division S.r.l. * @author Lombardia Informatica S.p.A.
*/ */
namespace arter\amos\news\assets; namespace elitedivision\amos\news\assets;
use yii\web\AssetBundle; use yii\web\AssetBundle;
use arter\amos\core\widget\WidgetAbstract; use elitedivision\amos\core\widget\WidgetAbstract;
class ModuleNewsAsset extends AssetBundle class ModuleNewsAsset extends AssetBundle
{ {
public $sourcePath = '@vendor/arter/amos-news/src/assets/web'; public $sourcePath = '@vendor/elitedivision/amos-news/src/assets/web';
public $css = [ public $css = [
'less/news.less', 'less/news.less',
...@@ -41,9 +41,9 @@ class ModuleNewsAsset extends AssetBundle ...@@ -41,9 +41,9 @@ class ModuleNewsAsset extends AssetBundle
} }
if(!empty($moduleL)){ if(!empty($moduleL)){
$this->depends [] = 'arter\amos\layout\assets\BaseAsset'; $this->depends [] = 'elitedivision\amos\layout\assets\BaseAsset';
}else{ }else{
$this->depends [] = 'arter\amos\core\views\assets\AmosCoreAsset'; $this->depends [] = 'elitedivision\amos\core\views\assets\AmosCoreAsset';
} }
parent::init(); parent::init();
} }
......
/** /**
IMPORT AMOS-LAYOUT VARIABLES IMPORT AMOS-LAYOUT VARIABLES
*/ */
@import (optional) "../../vendor/arter/amos-layout/src/assets/resources/base/less/variables.less"; @import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/variables.less";
@import (optional) "../../vendor/arter/amos-layout/src/assets/resources/base/less/utility.less"; @import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/utility.less";
/** /**
IMPORT STYLE-CUSTOM IMPORT STYLE-CUSTOM
*/ */
......
/** /**
IMPORT AMOS-LAYOUT VARIABLES IMPORT AMOS-LAYOUT VARIABLES
*/ */
@import (optional) "../../vendor/arter/amos-layout/src/assets/resources/base/less/v2/variables.less"; @import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/v2/variables.less";
@import (optional) "../../vendor/arter/amos-layout/src/assets/resources/base/less/v2/utility.less"; @import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/v2/utility.less";
/** /**
IMPORT STYLE-CUSTOM IMPORT STYLE-CUSTOM
*/ */
......
<?php <?php
/** /**
* Copyright 2020 Art-ER S. Cons. P.A. * Lombardia Informatica S.p.A.
* EROI - Emilia Romagna Open Innovation is based on: * OPEN 2.0
* https://www.open2.0.regione.lombardia.it
* *
* @see http://example.com Developers'community * @see http://example.com Developers'community
* @license GPLv3 * @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 * @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package arter\amos\news\components * @package elitedivision\amos\news\components
* @category CategoryName * @category CategoryName
* @author Elite Division S.r.l. * @author Lombardia Informatica S.p.A.
*/ */
namespace arter\amos\news\components; namespace elitedivision\amos\news\components;
use arter\amos\attachments\models\File; use elitedivision\amos\attachments\models\File;
use arter\amos\core\components\PartQuestionarioAbstract; use elitedivision\amos\core\components\PartQuestionarioAbstract;
use arter\amos\news\AmosNews; use elitedivision\amos\news\AmosNews;
use arter\amos\news\models\News; use elitedivision\amos\news\models\News;
use Yii; use Yii;
use yii\web\UploadedFile; use yii\web\UploadedFile;
/** /**
* Class PartsWizardNewsCreation * Class PartsWizardNewsCreation
* @package arter\amos\news\components * @package elitedivision\amos\news\components
*/ */
class PartsWizardNewsCreation extends PartQuestionarioAbstract class PartsWizardNewsCreation extends PartQuestionarioAbstract
{ {
......
<?php <?php
/** /**
* Copyright 2020 Art-ER S. Cons. P.A. * Lombardia Informatica S.p.A.
* EROI - Emilia Romagna Open Innovation is based on: * OPEN 2.0
* https://www.open2.0.regione.lombardia.it
* *
* @see http://example.com Developers'community * @see http://example.com Developers'community
* @license GPLv3 * @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 * @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package arter\amos\news * @package elitedivision\amos\news
* @category CategoryName * @category CategoryName
* @author Elite Division S.r.l. * @author Lombardia Informatica S.p.A.
*/ */
return [ return [
......
<?php <?php
/** /**
* Copyright 2020 Art-ER S. Cons. P.A. * Lombardia Informatica S.p.A.
* EROI - Emilia Romagna Open Innovation is based on: * OPEN 2.0
* https://www.open2.0.regione.lombardia.it
* *
* @see http://example.com Developers'community * @see http://example.com Developers'community
* @license GPLv3 * @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 * @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package arter\amos\news * @package elitedivision\amos\news
* @category CategoryName * @category CategoryName
* @author Elite Division S.r.l. * @author Lombardia Informatica S.p.A.
*/ */
/** /**
......
<?php <?php
/** /**
* Copyright 2020 Art-ER S. Cons. P.A. * Lombardia Informatica S.p.A.
* EROI - Emilia Romagna Open Innovation is based on: * OPEN 2.0
* https://www.open2.0.regione.lombardia.it
* *
* @see http://example.com Developers'community * @see http://example.com Developers'community
* @license GPLv3 * @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 * @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
* *
* @package arter\amos\news\controllers * @package elitedivision\amos\news\controllers
* @category CategoryName * @category CategoryName
* @author Elite Division S.r.l. * @author Lombardia Informatica S.p.A.
*/ */
namespace arter\amos\news\controllers; namespace elitedivision\amos\news\controllers;
use arter\amos\dashboard\controllers\base\DashboardController; use elitedivision\amos\dashboard\controllers\base\DashboardController;
use yii\helpers\Url; use yii\helpers\Url;
class DefaultController extends DashboardController class DefaultController extends DashboardController
...@@ -70,7 +70,7 @@ class DefaultController extends DashboardController ...@@ -70,7 +70,7 @@ class DefaultController extends DashboardController
$module = \Yii::$app->getModule('layout'); $module = \Yii::$app->getModule('layout');
if (empty($module)) { if (empty($module)) {
if (strpos($this->layout, '@') === false) { if (strpos($this->layout, '@') === false) {
$this->layout = '@vendor/arter/amos-core/views/layouts/'.(!empty($layout) ? $layout