Commit 10cf0748 authored by Aster's avatar Aster Committed by waltermazza
Browse files

General Bug Fixes and Improvements

parent ee68dbd4
......@@ -7,31 +7,31 @@ You need to require this package and enable the module in your configuration.
add to composer requirements in composer.json
```
"elitedivision/amos-news": "dev-master",
"arter/amos-news": "dev-master",
```
or run command bash:
```bash
composer require "elitedivision/amos-news:dev-master"
composer require "arter/amos-news:dev-master"
```
Enable the News modules in modules-amos.php, add :
```php
'news' => [
'class' => 'elitedivision\amos\news\AmosNews',
'class' => 'arter\amos\news\AmosNews',
],
```
add news migrations to console modules (console/config/migrations-amos.php):
```
'@vendor/elitedivision/amos-news/src/migrations'
'@vendor/arter/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' => 'elitedivision\amos\news\AmosNews',
'class' => 'arter\amos\news\AmosNews',
'params' => [
'site_publish_enabled' => true,
'site_featured_enabled' => true
......@@ -57,11 +57,11 @@ for reports:
```
'report' => [
'class' => 'elitedivision\amos\report\AmosReport',
'class' => 'arter\amos\report\AmosReport',
'modelsEnabled' => [
.
.
'elitedivision\amos\news\models\News', //line to add
'arter\amos\news\models\News', //line to add
.
.
]
......@@ -73,11 +73,11 @@ for comments:
```
'comments' => [
'class' => 'elitedivision\amos\comments\AmosComments',
'class' => 'arter\amos\comments\AmosComments',
'modelsEnabled' => [
.
.
'elitedivision\amos\news\models\News', //line to add
'arter\amos\news\models\News', //line to add
.
.
],
......@@ -92,7 +92,7 @@ If some property default is not suitable for your project, you can configure it
```php
'news' => [
'class' => 'elitedivision\amos\news\AmosNews',
'class' => 'arter\amos\news\AmosNews',
'validatePublicationDate' => false, //changed property (default was true)
],
```
......@@ -110,7 +110,7 @@ and set to true the Module property filterCategoriesByRole in configurations:
```php
'news' => [
'class' => 'elitedivision\amos\news\AmosNews',
'class' => 'arter\amos\news\AmosNews',
'filterCategoriesByRole' => true
]
```
......@@ -123,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' => 'elitedivision\amos\news\AmosNews',
'class' => 'arter\amos\news\AmosNews',
'newsRequiredFields' => ['news_categorie_id', 'status']
],
```
......@@ -132,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' => 'elitedivision\amos\news\AmosNews',
'class' => 'arter\amos\news\AmosNews',
'defaultCategory' => 3
],
```
......@@ -140,7 +140,7 @@ 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' => 'elitedivision\amos\news\AmosNews',
'class' => 'arter\amos\news\AmosNews',
'autoUpdatePublicationDate' => true
],
```
......
{
"name": "elitedivision/amos-news",
"name": "arter/amos-news",
"description": "Sistema AMOS per le news",
"keywords": ["amos", "yii2", "news"],
"homepage": "http://www.elitedivision.it/",
"homepage": "http://www.arter.it/",
"type": "component",
"license": "BSD-3-Clause",
"proscription": "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/elitedivision/amos-news"
"source": "https://github.com/arter/amos-news"
},
"require": {
"php": ">=5.4.0",
"2amigos/yii2-ckeditor-widget": "~1.0",
"cornernote/yii2-workflow-manager": "*",
"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": "*",
"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": "*",
"raoul2000/yii2-workflow": "*",
"raoul2000/yii2-workflow-view": "*",
"yiidoc/yii2-redactor": "*",
......@@ -41,7 +41,7 @@
},
"autoload": {
"psr-4": {
"elitedivision\\amos\\news\\": "src"
"arter\\amos\\news\\": "src"
}
},
"require-dev": {
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\news
* @package arter\amos\news
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
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;
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;
use yii\helpers\ArrayHelper;
/**
* Class AmosNews
* @package elitedivision\amos\news
* @package arter\amos\news
*/
class AmosNews extends AmosModule implements ModuleInterface, SearchModuleInterface, CmsModuleInterface {
......@@ -137,11 +133,11 @@ class AmosNews extends AmosModule implements ModuleInterface, SearchModuleInterf
* @var array
*/
public $viewPathEmailSummary = [
'elitedivision\amos\news\models\News' => '@vendor/elitedivision/amos-news/src/views/email/notify_summary'
'arter\amos\news\models\News' => '@vendor/arter/amos-news/src/views/email/notify_summary'
];
public $viewPathEmailSummaryNetwork = [
'elitedivision\amos\news\models\News' => '@vendor/elitedivision/amos-news/src/views/email/notify_summary_network'
'arter\amos\news\models\News' => '@vendor/arter/amos-news/src/views/email/notify_summary_network'
];
/*
* @var bool disableStandardWorkflow Disable standard worflow, direct publish
......@@ -189,7 +185,7 @@ class AmosNews extends AmosModule implements ModuleInterface, SearchModuleInterf
public function init() {
parent::init();
\Yii::setAlias('@elitedivision/amos/' . static::getModuleName() . '/controllers', __DIR__ . '/controllers');
\Yii::setAlias('@arter/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
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\news
* @package arter\amos\news
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\news\assets;
namespace arter\amos\news\assets;
use yii\web\AssetBundle;
use elitedivision\amos\core\widget\WidgetAbstract;
use arter\amos\core\widget\WidgetAbstract;
class ModuleNewsAsset extends AssetBundle
{
public $sourcePath = '@vendor/elitedivision/amos-news/src/assets/web';
public $sourcePath = '@vendor/arter/amos-news/src/assets/web';
public $css = [
'less/news.less',
......@@ -41,9 +37,9 @@ class ModuleNewsAsset extends AssetBundle
}
if(!empty($moduleL)){
$this->depends [] = 'elitedivision\amos\layout\assets\BaseAsset';
$this->depends [] = 'arter\amos\layout\assets\BaseAsset';
}else{
$this->depends [] = 'elitedivision\amos\core\views\assets\AmosCoreAsset';
$this->depends [] = 'arter\amos\core\views\assets\AmosCoreAsset';
}
parent::init();
}
......
/**
IMPORT AMOS-LAYOUT VARIABLES
*/
@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 (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 STYLE-CUSTOM
*/
......
/**
IMPORT AMOS-LAYOUT VARIABLES
*/
@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 (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 STYLE-CUSTOM
*/
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\news\components
* @package arter\amos\news\components
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\news\components;
namespace arter\amos\news\components;
use elitedivision\amos\attachments\models\File;
use elitedivision\amos\core\components\PartQuestionarioAbstract;
use elitedivision\amos\news\AmosNews;
use elitedivision\amos\news\models\News;
use arter\amos\attachments\models\File;
use arter\amos\core\components\PartQuestionarioAbstract;
use arter\amos\news\AmosNews;
use arter\amos\news\models\News;
use Yii;
use yii\web\UploadedFile;
/**
* Class PartsWizardNewsCreation
* @package elitedivision\amos\news\components
* @package arter\amos\news\components
*/
class PartsWizardNewsCreation extends PartQuestionarioAbstract
{
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\news
* @package arter\amos\news
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
return [
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\news
* @package arter\amos\news
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
/**
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\news\controllers
* @package arter\amos\news\controllers
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\news\controllers;
namespace arter\amos\news\controllers;
use elitedivision\amos\dashboard\controllers\base\DashboardController;
use arter\amos\dashboard\controllers\base\DashboardController;
use yii\helpers\Url;
class DefaultController extends DashboardController
......@@ -70,7 +66,7 @@ class DefaultController extends DashboardController
$module = \Yii::$app->getModule('layout');
if (empty($module)) {
if (strpos($this->layout, '@') === false) {
$this->layout = '@vendor/elitedivision/amos-core/views/layouts/'.(!empty($layout) ? $layout : $this->layout);
$this->layout = '@vendor/arter/amos-core/views/layouts/'.(!empty($layout) ? $layout : $this->layout);
}
return true;
}
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\news
* @package arter\amos\news
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
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;
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;
use Yii;
use yii\helpers\Url;
use elitedivision\amos\core\widget\WidgetAbstract;
use arter\amos\core\widget\WidgetAbstract;
/**
* Class NewsCategorieController
......@@ -34,7 +30,7 @@ use elitedivision\amos\core\widget\WidgetAbstract;
*
* @property NewsCategorie $model
*
* @package elitedivision\amos\news\controllers
* @package arter\amos\news\controllers
*/
class NewsCategorieController extends CrudController
{
......@@ -220,7 +216,7 @@ class NewsCategorieController extends CrudController
$module = \Yii::$app->getModule('layout');
if (empty($module)) {
if (strpos($this->layout, '@') === false) {
$this->layout = '@vendor/elitedivision/amos-core/views/layouts/' . (!empty($layout) ? $layout : $this->layout);
$this->layout = '@vendor/arter/amos-core/views/layouts/' . (!empty($layout) ? $layout : $this->layout);
}
return true;
}
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\news
* @package arter\amos\news
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
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;
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;
use raoul2000\workflow\base\WorkflowException;
use Yii;
use yii\filters\AccessControl;
......@@ -32,14 +28,14 @@ use yii\helpers\ArrayHelper;
use yii\helpers\Url;
use yii\web\View;
use ReflectionClass;
use elitedivision\amos\core\widget\WidgetAbstract;
use arter\amos\core\widget\WidgetAbstract;
/**
* Class NewsController
*
* NewsController implements the CRUD actions for News model.
*
* @package elitedivision\amos\news\controllers
* @package arter\amos\news\controllers
*/
class NewsController extends CrudController
{
......@@ -253,7 +249,7 @@ class NewsController extends CrudController
if (!empty($this->scope)) {
if (isset($this->scope['community'])) {
$communityId = $this->scope['community'];
$community = \elitedivision\amos\community\models\Community::findOne($communityId);
$community = \arter\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];
......@@ -262,7 +258,7 @@ class NewsController extends CrudController
}
/**
* Set a view param used in \elitedivision\amos\core\forms\CreateNewButtonWidget
* Set a view param used in \arter\amos\core\forms\CreateNewButtonWidget
*/
private function setCreateNewBtnLabel()
{
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\news\controllers
* @package arter\amos\news\controllers
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\news\controllers;
namespace arter\amos\news\controllers;
use elitedivision\amos\core\behaviors\TaggableBehavior;
use elitedivision\amos\core\controllers\CrudController;
use elitedivision\amos\core\module\BaseAmosModule;
use elitedivision\amos\news\AmosNews;
use elitedivision\amos\news\components\PartsWizardNewsCreation;
use elitedivision\amos\news\models\News;
use elitedivision\amos\news\models\search\NewsSearch;
use arter\amos\core\behaviors\TaggableBehavior;
use arter\amos\core\controllers\CrudController;
use arter\amos\core\module\BaseAmosModule;
use arter\amos\news\AmosNews;
use arter\amos\news\components\PartsWizardNewsCreation;
use arter\amos\news\models\News;
use arter\amos\news\models\search\NewsSearch;
use Yii;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
......@@ -31,9 +27,9 @@ use yii\helpers\Url;
/**
* Class NewsWizardController
*
* @property \elitedivision\amos\news\models\News $model
* @property \arter\amos\news\models\News $model
*
* @package elitedivision\amos\news\controllers
* @package arter\amos\news\controllers
*/
class NewsWizardController extends CrudController
{
......@@ -316,7 +312,7 @@ class NewsWizardController extends CrudController
$module = \Yii::$app->getModule('layout');
if (empty($module)) {
if (strpos($this->layout, '@') === false) {
$this->layout = '@vendor/elitedivision/amos-core/views/layouts/'.(!empty($layout) ? $layout : $this->layout);
$this->layout = '@vendor/arter/amos-core/views/layouts/'.(!empty($layout) ? $layout : $this->layout);
}
return true;
}
......