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.
add to composer requirements in composer.json
```
"arter/amos-news": "dev-master",
"elitedivision/amos-news": "dev-master",
```
or run command 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 :
```php
'news' => [
'class' => 'arter\amos\news\AmosNews',
'class' => 'elitedivision\amos\news\AmosNews',
],
```
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:
```php
'news' => [
'class' => 'arter\amos\news\AmosNews',
'class' => 'elitedivision\amos\news\AmosNews',
'params' => [
'site_publish_enabled' => true,
'site_featured_enabled' => true
......@@ -47,19 +47,21 @@ To do so:
- search for news in content configuration section
- 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:
```
'report' => [
'class' => 'arter\amos\report\AmosReport',
'class' => 'elitedivision\amos\report\AmosReport',
'modelsEnabled' => [
.
.
'arter\amos\news\models\News', //line to add
'elitedivision\amos\news\models\News', //line to add
.
.
]
......@@ -71,11 +73,11 @@ for comments:
```
'comments' => [
'class' => 'arter\amos\comments\AmosComments',
'class' => 'elitedivision\amos\comments\AmosComments',
'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
```php
'news' => [
'class' => 'arter\amos\news\AmosNews',
'class' => 'elitedivision\amos\news\AmosNews',
'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.
* **filterCategoriesByRole** - boolean, default = false
If true, enables category role check via table news_category_roles_mm.
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
'news' => [
'class' => 'arter\amos\news\AmosNews',
'class' => 'elitedivision\amos\news\AmosNews',
'filterCategoriesByRole' => true
]
```
......@@ -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:
```php
'news' => [
'class' => 'arter\amos\news\AmosNews',
'class' => 'elitedivision\amos\news\AmosNews',
'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,
The ID of the default category pre-selected for the new News
```php
'news' => [
'class' => 'arter\amos\news\AmosNews',
'class' => 'elitedivision\amos\news\AmosNews',
'defaultCategory' => 3
],
```
......@@ -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
```php
'news' => [
'class' => 'arter\amos\news\AmosNews',
'class' => 'elitedivision\amos\news\AmosNews',
'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",
"keywords": ["amos", "yii2", "news"],
"homepage": "http://www.arter.it/",
"homepage": "http://www.elitedivision.it/",
"type": "component",
"license": "BSD-3-Clause",
"support": {
"issues": "http://www.example.com/",
"forum": "http://www.example.com/forum/",
"wiki": "http://www.example.com/wiki/",
"source": "https://github.com/arter/amos-news"
"source": "https://github.com/elitedivision/amos-news"
},
"require": {
"php": ">=5.4.0",
"2amigos/yii2-ckeditor-widget": "~1.0",
"cornernote/yii2-workflow-manager": "*",
"arter/amos-admin":"^2.2.0",
"arter/amos-attachments": "^1.1.11",
"arter/amos-comments":"^1.1",
"arter/amos-core":"^1.15.0",
"arter/amos-dashboard":"^1.8.4",
"arter/amos-notify":"^1.4.13",
"arter/amos-report":"^1.0.5",
"arter/amos-workflow": "^1.0.5",
"arter/amos-seo": "*",
"elitedivision/amos-admin":"^2.2.0",
"elitedivision/amos-attachments": "^1.1.11",
"elitedivision/amos-comments":"^1.1",
"elitedivision/amos-core":"^1.15.0",
"elitedivision/amos-dashboard":"^1.8.4",
"elitedivision/amos-notify":"^1.4.13",
"elitedivision/amos-report":"^1.0.5",
"elitedivision/amos-workflow": "^1.0.5",
"elitedivision/amos-seo": "*",
"raoul2000/yii2-workflow": "*",
"raoul2000/yii2-workflow-view": "*",
"yiidoc/yii2-redactor": "*",
......@@ -41,7 +41,7 @@
},
"autoload": {
"psr-4": {
"arter\\amos\\news\\": "src"
"elitedivision\\amos\\news\\": "src"
}
},
"require-dev": {
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
* @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
* @author Elite Division S.r.l.
* @author Lombardia Informatica S.p.A.
*/
namespace arter\amos\news;
use arter\amos\core\interfaces\CmsModuleInterface;
use arter\amos\core\interfaces\SearchModuleInterface;
use arter\amos\core\module\AmosModule;
use arter\amos\core\module\ModuleInterface;
use arter\amos\news\widgets\graphics\WidgetGraphicsUltimeNews;
use arter\amos\news\widgets\icons\WidgetIconAllNews;
use arter\amos\news\widgets\icons\WidgetIconNews;
use arter\amos\news\widgets\icons\WidgetIconNewsCategorie;
use arter\amos\news\widgets\icons\WidgetIconNewsCreatedBy;
use arter\amos\news\widgets\icons\WidgetIconNewsDashboard;
use arter\amos\news\widgets\icons\WidgetIconNewsDaValidare;
namespace elitedivision\amos\news;
use elitedivision\amos\core\interfaces\CmsModuleInterface;
use elitedivision\amos\core\interfaces\SearchModuleInterface;
use elitedivision\amos\core\module\AmosModule;
use elitedivision\amos\core\module\ModuleInterface;
use elitedivision\amos\news\widgets\graphics\WidgetGraphicsUltimeNews;
use elitedivision\amos\news\widgets\icons\WidgetIconAllNews;
use elitedivision\amos\news\widgets\icons\WidgetIconNews;
use elitedivision\amos\news\widgets\icons\WidgetIconNewsCategorie;
use elitedivision\amos\news\widgets\icons\WidgetIconNewsCreatedBy;
use elitedivision\amos\news\widgets\icons\WidgetIconNewsDashboard;
use elitedivision\amos\news\widgets\icons\WidgetIconNewsDaValidare;
use yii\helpers\ArrayHelper;
/**
* Class AmosNews
* @package arter\amos\news
* @package elitedivision\amos\news
*/
class AmosNews extends AmosModule implements ModuleInterface, SearchModuleInterface, CmsModuleInterface {
......@@ -137,11 +137,11 @@ class AmosNews extends AmosModule implements ModuleInterface, SearchModuleInterf
* @var array
*/
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 = [
'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
......@@ -189,7 +189,7 @@ class AmosNews extends AmosModule implements ModuleInterface, SearchModuleInterf
public function 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
$config = require(__DIR__ . DIRECTORY_SEPARATOR . self::$CONFIG_FOLDER . DIRECTORY_SEPARATOR . 'config.php');
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
* @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
* @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 arter\amos\core\widget\WidgetAbstract;
use elitedivision\amos\core\widget\WidgetAbstract;
class ModuleNewsAsset extends AssetBundle
{
public $sourcePath = '@vendor/arter/amos-news/src/assets/web';
public $sourcePath = '@vendor/elitedivision/amos-news/src/assets/web';
public $css = [
'less/news.less',
......@@ -41,9 +41,9 @@ class ModuleNewsAsset extends AssetBundle
}
if(!empty($moduleL)){
$this->depends [] = 'arter\amos\layout\assets\BaseAsset';
$this->depends [] = 'elitedivision\amos\layout\assets\BaseAsset';
}else{
$this->depends [] = 'arter\amos\core\views\assets\AmosCoreAsset';
$this->depends [] = 'elitedivision\amos\core\views\assets\AmosCoreAsset';
}
parent::init();
}
......
/**
IMPORT AMOS-LAYOUT VARIABLES
*/
@import (optional) "../../vendor/arter/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/variables.less";
@import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/utility.less";
/**
IMPORT STYLE-CUSTOM
*/
......
/**
IMPORT AMOS-LAYOUT VARIABLES
*/
@import (optional) "../../vendor/arter/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/variables.less";
@import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/v2/utility.less";
/**
IMPORT STYLE-CUSTOM
*/
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
* @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
* @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 arter\amos\core\components\PartQuestionarioAbstract;
use arter\amos\news\AmosNews;
use arter\amos\news\models\News;
use elitedivision\amos\attachments\models\File;
use elitedivision\amos\core\components\PartQuestionarioAbstract;
use elitedivision\amos\news\AmosNews;
use elitedivision\amos\news\models\News;
use Yii;
use yii\web\UploadedFile;
/**
* Class PartsWizardNewsCreation
* @package arter\amos\news\components
* @package elitedivision\amos\news\components
*/
class PartsWizardNewsCreation extends PartQuestionarioAbstract
{
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
* @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
* @author Elite Division S.r.l.
* @author Lombardia Informatica S.p.A.
*/
return [
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
* @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
* @author Elite Division S.r.l.
* @author Lombardia Informatica S.p.A.
*/
/**
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
* @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
* @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;
class DefaultController extends DashboardController
......@@ -70,7 +70,7 @@ class DefaultController extends DashboardController
$module = \Yii::$app->getModule('layout');
if (empty($module)) {
if (strpos($this->layout, '@') === false) {
$this->layout = '@vendor/arter/amos-core/views/layouts/'.(!empty($layout) ? $layout : $this->layout);
$this->layout = '@vendor/elitedivision/amos-core/views/layouts/'.(!empty($layout) ? $layout : $this->layout);
}
return true;
}
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
* @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
* @author Elite Division S.r.l.
* @author Lombardia Informatica S.p.A.
*/
namespace arter\amos\news\controllers;
use arter\amos\core\controllers\CrudController;
use arter\amos\core\helpers\Html;
use arter\amos\core\icons\AmosIcons;
use arter\amos\dashboard\controllers\TabDashboardControllerTrait;
use arter\amos\news\AmosNews;
use arter\amos\news\models\NewsCategorie;
use arter\amos\news\models\NewsCategoryCommunityMm;
use arter\amos\news\models\NewsCategoryRolesMm;
use arter\amos\news\models\search\NewsCategorieSearch;
namespace elitedivision\amos\news\controllers;
use elitedivision\amos\core\controllers\CrudController;
use elitedivision\amos\core\helpers\Html;
use elitedivision\amos\core\icons\AmosIcons;
use elitedivision\amos\dashboard\controllers\TabDashboardControllerTrait;
use elitedivision\amos\news\AmosNews;
use elitedivision\amos\news\models\NewsCategorie;
use elitedivision\amos\news\models\NewsCategoryCommunityMm;
use elitedivision\amos\news\models\NewsCategoryRolesMm;
use elitedivision\amos\news\models\search\NewsCategorieSearch;
use Yii;
use yii\helpers\Url;
use arter\amos\core\widget\WidgetAbstract;
use elitedivision\amos\core\widget\WidgetAbstract;
/**
* Class NewsCategorieController
......@@ -34,7 +34,7 @@ use arter\amos\core\widget\WidgetAbstract;
*
* @property NewsCategorie $model
*
* @package arter\amos\news\controllers
* @package elitedivision\amos\news\controllers
*/
class NewsCategorieController extends CrudController
{
......@@ -220,7 +220,7 @@ class NewsCategorieController extends CrudController
$module = \Yii::$app->getModule('layout');
if (empty($module)) {
if (strpos($this->layout, '@') === false) {
$this->layout = '@vendor/arter/amos-core/views/layouts/' . (!empty($layout) ? $layout : $this->layout);
$this->layout = '@vendor/elitedivision/amos-core/views/layouts/' . (!empty($layout) ? $layout : $this->layout);
}
return true;
}
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
* @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
* @author Elite Division S.r.l.
* @author Lombardia Informatica S.p.A.
*/
namespace arter\amos\news\controllers;
use arter\amos\core\controllers\CrudController;
use arter\amos\core\helpers\BreadcrumbHelper;
use arter\amos\core\helpers\Html;
use arter\amos\core\icons\AmosIcons;
use arter\amos\cwh\query\CwhActiveQuery;
use arter\amos\dashboard\controllers\TabDashboardControllerTrait;
use arter\amos\news\AmosNews;
use arter\amos\news\assets\ModuleNewsAsset;
use arter\amos\news\models\News;
use arter\amos\news\models\search\NewsSearch;
namespace elitedivision\amos\news\controllers;
use elitedivision\amos\core\controllers\CrudController;
use elitedivision\amos\core\helpers\BreadcrumbHelper;
use elitedivision\amos\core\helpers\Html;
use elitedivision\amos\core\icons\AmosIcons;
use elitedivision\amos\cwh\query\CwhActiveQuery;
use elitedivision\amos\dashboard\controllers\TabDashboardControllerTrait;
use elitedivision\amos\news\AmosNews;
use elitedivision\amos\news\assets\ModuleNewsAsset;
use elitedivision\amos\news\models\News;
use elitedivision\amos\news\models\search\NewsSearch;
use raoul2000\workflow\base\WorkflowException;
use Yii;
use yii\filters\AccessControl;
......@@ -33,14 +32,14 @@ use yii\helpers\ArrayHelper;
use yii\helpers\Url;
use yii\web\View;
use ReflectionClass;
use arter\amos\core\widget\WidgetAbstract;
use elitedivision\amos\core\widget\WidgetAbstract;
/**
* Class NewsController
*
* NewsController implements the CRUD actions for News model.
*
* @package arter\amos\news\controllers
* @package elitedivision\amos\news\controllers
*/
class NewsController extends CrudController
{
......@@ -254,7 +253,7 @@ class NewsController extends CrudController
if (!empty($this->scope)) {
if (isset($this->scope['community'])) {
$communityId = $this->scope['community'];
$community = \arter\amos\community\models\Community::findOne($communityId);
$community = \elitedivision\amos\community\models\Community::findOne($communityId);
$dashboardCommunityTitle = AmosNews::t('amosnews', "Dashboard").' '.$community->name;
$dasbboardCommunityUrl = Yii::$app->urlManager->createUrl(['community/join', 'id' => $communityId]);
Yii::$app->view->params['breadcrumbs'][] = ['label' => $dashboardCommunityTitle, 'url' => $dasbboardCommunityUrl];
......@@ -263,7 +262,7 @@ class NewsController extends CrudController
}
/**
* Set a view param used in \arter\amos\core\forms\CreateNewButtonWidget
* Set a view param used in \elitedivision\amos\core\forms\CreateNewButtonWidget
*/
private function setCreateNewBtnLabel()
{
......
<?php
/**
* Copyright 2020 Art-ER S. Cons. P.A.
* EROI - Emilia Romagna Open Innovation is based on:
* https://www.open2.0.regione.lombardia.it
* Lombardia Informatica S.p.A.
* OPEN 2.0
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package arter\amos\news\controllers