Commit 7d88dfc1 authored by Aster's avatar Aster Committed by waltermazza
Browse files

General Bug Fixes and Improvements

parent c4ff4ea4
...@@ -11,13 +11,13 @@ Installation ...@@ -11,13 +11,13 @@ Installation
Either run Either run
```bash ```bash
composer require elitedivision/amos-comments composer require arter/amos-comments
``` ```
or add this row or add this row
``` ```
"elitedivision/amos-comments": "dev-master" "arter/amos-comments": "dev-master"
``` ```
to the require section of your `composer.json` file. to the require section of your `composer.json` file.
...@@ -28,11 +28,11 @@ to the require section of your `composer.json` file. ...@@ -28,11 +28,11 @@ to the require section of your `composer.json` file.
<?php <?php
'modules' => [ 'modules' => [
'comments' => [ 'comments' => [
'class' => 'elitedivision\amos\comments\AmosComments', 'class' => 'arter\amos\comments\AmosComments',
'modelsEnabled' => [ 'modelsEnabled' => [
/** /**
* Add here the classnames of the models where you want the comments * Add here the classnames of the models where you want the comments
* (i.e. 'elitedivision\amos\events\models\Event') * (i.e. 'arter\amos\events\models\Event')
*/ */
], ],
// the following are mandatory fields // the following are mandatory fields
...@@ -57,7 +57,7 @@ Also, add these lines to your bootstrap: ...@@ -57,7 +57,7 @@ Also, add these lines to your bootstrap:
<?php <?php
'components' => [ 'components' => [
'view' => [ 'view' => [
'class' => 'elitedivision\amos\core\components\AmosView', 'class' => 'arter\amos\core\components\AmosView',
], ],
], ],
``` ```
...@@ -65,7 +65,7 @@ Also, add these lines to your bootstrap: ...@@ -65,7 +65,7 @@ Also, add these lines to your bootstrap:
4 Apply migrations 4 Apply migrations
```bash ```bash
php yii migrate/up --migrationPath=@vendor/elitedivision/amos-comments/src/migrations php yii migrate/up --migrationPath=@vendor/arter/amos-comments/src/migrations
``` ```
or add this row to your migrations config in console: or add this row to your migrations config in console:
...@@ -73,7 +73,7 @@ or add this row to your migrations config in console: ...@@ -73,7 +73,7 @@ or add this row to your migrations config in console:
```php ```php
<?php <?php
return [ return [
'@vendor/elitedivision/amos-comments/src/migrations', '@vendor/arter/amos-comments/src/migrations',
]; ];
``` ```
...@@ -81,7 +81,7 @@ return [ ...@@ -81,7 +81,7 @@ return [
```php ```php
<?php <?php
use elitedivision\amos\comments\models\CommentInterface; use arter\amos\comments\models\CommentInterface;
/** /**
* Implement the CommentInterface * Implement the CommentInterface
...@@ -103,7 +103,7 @@ public function isCommentable() ...@@ -103,7 +103,7 @@ public function isCommentable()
<?php <?php
'modules' => [ 'modules' => [
'comments' => [ 'comments' => [
'class' => 'elitedivision\amos\comments\AmosComments', 'class' => 'arter\amos\comments\AmosComments',
'modelsEnabled' => [ 'modelsEnabled' => [
'class_namespace\MyClass' 'class_namespace\MyClass'
] ]
...@@ -118,7 +118,7 @@ public function isCommentable() ...@@ -118,7 +118,7 @@ public function isCommentable()
<?php <?php
'modules' => [ 'modules' => [
'comments' => [ 'comments' => [
'class' => 'elitedivision\amos\comments\AmosComments', 'class' => 'arter\amos\comments\AmosComments',
'enableMailsNotification' => false, 'enableMailsNotification' => false,
'modelsEnabled' => [ 'modelsEnabled' => [
'class_namespace\MyClass' 'class_namespace\MyClass'
...@@ -133,9 +133,9 @@ you can insert an array ...@@ -133,9 +133,9 @@ you can insert an array
```php ```php
'comments' => [ 'comments' => [
'htmlMailContent' => [ 'htmlMailContent' => [
'elitedivision\amos\news\models\News' => '@backend/mail/comment/content_news', 'arter\amos\news\models\News' => '@backend/mail/comment/content_news',
'elitedivision\amos\discussioni\models\DiscussioniTopic' => '@backend/mail/comment/content_discussioni', 'arter\amos\discussioni\models\DiscussioniTopic' => '@backend/mail/comment/content_discussioni',
'elitedivision\amos\documenti\models\Documenti' => '@backend/mail/comment/content_documenti' 'arter\amos\documenti\models\Documenti' => '@backend/mail/comment/content_documenti'
], ],
``` ```
or a string if the conente is valid for all contents(news/discussioni/docuemnts/ecc..) or a string if the conente is valid for all contents(news/discussioni/docuemnts/ecc..)
......
{ {
"name": "elitedivision/amos-comments", "name": "arter/amos-comments",
"description": "Comments for contents - plugin", "description": "Comments for contents - plugin",
"keywords": ["amos", "yii2", "comments"], "keywords": ["amos", "yii2", "comments"],
"type": "plugin", "type": "plugin",
"license": "BSD-3-Clause", "proscription": "BSD-3-Clause",
"require": { "require": {
"php": ">=5.4.0", "php": ">=5.4.0",
"elitedivision/amos-admin": "^2.0", "arter/amos-admin": "^2.0",
"elitedivision/amos-attachments": "^1.1.9", "arter/amos-attachments": "^1.1.9",
"elitedivision/amos-core": "^1.20.2" "arter/amos-core": "^1.20.2"
}, },
"extra": { "extra": {
"asset-installer-paths": { "asset-installer-paths": {
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"elitedivision\\amos\\comments\\": "src" "arter\\amos\\comments\\": "src"
} }
} }
} }
\ No newline at end of file
<?php <?php
/** /**
* Lombardia Informatica S.p.A. * Emilia Romagna Open Innovation
* OPEN 2.0 * 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\comments * @package arter\amos\comments
* @category CategoryName * @category CategoryName
* @author Lombardia Informatica S.p.A.
*/ */
namespace elitedivision\amos\comments; namespace arter\amos\comments;
use elitedivision\amos\comments\components\CommentComponent; use arter\amos\comments\components\CommentComponent;
use elitedivision\amos\comments\models\Comment; use arter\amos\comments\models\Comment;
use elitedivision\amos\comments\models\CommentReply; use arter\amos\comments\models\CommentReply;
use elitedivision\amos\core\components\AmosView; use arter\amos\core\components\AmosView;
use elitedivision\amos\core\module\AmosModule; use arter\amos\core\module\AmosModule;
use elitedivision\amos\core\module\ModuleInterface; use arter\amos\core\module\ModuleInterface;
use elitedivision\amos\core\record\Record; use arter\amos\core\record\Record;
use yii\base\BootstrapInterface; use yii\base\BootstrapInterface;
use yii\base\Event; use yii\base\Event;
use yii\db\ActiveRecord; use yii\db\ActiveRecord;
...@@ -28,7 +24,7 @@ use yii\helpers\VarDumper; ...@@ -28,7 +24,7 @@ use yii\helpers\VarDumper;
/** /**
* Class AmosComments * Class AmosComments
* @package elitedivision\amos\comments * @package arter\amos\comments
*/ */
class AmosComments extends AmosModule implements ModuleInterface, BootstrapInterface class AmosComments extends AmosModule implements ModuleInterface, BootstrapInterface
{ {
...@@ -44,7 +40,7 @@ class AmosComments extends AmosModule implements ModuleInterface, BootstrapInter ...@@ -44,7 +40,7 @@ class AmosComments extends AmosModule implements ModuleInterface, BootstrapInter
/** /**
* @inheritdoc * @inheritdoc
*/ */
public $controllerNamespace = 'elitedivision\amos\comments\controllers'; public $controllerNamespace = 'arter\amos\comments\controllers';
public $newFileMode = 0666; public $newFileMode = 0666;
public $name = 'Comments'; public $name = 'Comments';
public $layoutInverted = false; public $layoutInverted = false;
...@@ -63,51 +59,51 @@ class AmosComments extends AmosModule implements ModuleInterface, BootstrapInter ...@@ -63,51 +59,51 @@ class AmosComments extends AmosModule implements ModuleInterface, BootstrapInter
/** /**
* This is the html used to render the subject of the e-mail. In the view is available the variable $profile * This is the html used to render the subject of the e-mail. In the view is available the variable $profile
* that is an instance of 'elitedivision\amos\admin\models\UserProfile' * that is an instance of 'arter\amos\admin\models\UserProfile'
* @var string * @var string
*/ */
public $htmlMailContentSubject = '@vendor/elitedivision/amos-comments/src/views/comment/email/content_subject'; public $htmlMailContentSubject = '@vendor/arter/amos-comments/src/views/comment/email/content_subject';
// public $htmlMailContentTitle = [ // public $htmlMailContentTitle = [
// 'elitedivision\amos\news\models\News' => '@vendor/elitedivision/amos-comments/src/views/comment/email/content_subject_news', // 'arter\amos\news\models\News' => '@vendor/arter/amos-comments/src/views/comment/email/content_subject_news',
// 'elitedivision\amos\discussioni\models\DiscussioniTopic' => '@vendor/elitedivision/amos-comments/src/views/comment/email/content_subject_discussioni', // 'arter\amos\discussioni\models\DiscussioniTopic' => '@vendor/arter/amos-comments/src/views/comment/email/content_subject_discussioni',
// 'elitedivision\amos\documenti\models\Documenti' => '@vendor/elitedivision/amos-comments/src/views/comment/email/content_subjcet_documenti' // 'arter\amos\documenti\models\Documenti' => '@vendor/arter/amos-comments/src/views/comment/email/content_subjcet_documenti'
// ]; // ];
public $htmlMailContentSubjectDefault = '@vendor/elitedivision/amos-comments/src/views/comment/email/content_subject'; public $htmlMailContentSubjectDefault = '@vendor/arter/amos-comments/src/views/comment/email/content_subject';
/** /**
* This is the html used to render the subject of the e-mail. In the view is available the variable $profile * This is the html used to render the subject of the e-mail. In the view is available the variable $profile
* that is an instance of 'elitedivision\amos\admin\models\UserProfile' * that is an instance of 'arter\amos\admin\models\UserProfile'
* @var string * @var string
*/ */
public $htmlMailContentTitle = '@vendor/elitedivision/amos-comments/src/views/comment/email/content_title'; public $htmlMailContentTitle = '@vendor/arter/amos-comments/src/views/comment/email/content_title';
// public $htmlMailContentTitle = [ // public $htmlMailContentTitle = [
// 'elitedivision\amos\news\models\News' => '@vendor/elitedivision/amos-comments/src/views/comment/email/content_title_news', // 'arter\amos\news\models\News' => '@vendor/arter/amos-comments/src/views/comment/email/content_title_news',
// 'elitedivision\amos\discussioni\models\DiscussioniTopic' => '@vendor/elitedivision/amos-comments/src/views/comment/email/content_title_discussioni', // 'arter\amos\discussioni\models\DiscussioniTopic' => '@vendor/arter/amos-comments/src/views/comment/email/content_title_discussioni',
// 'elitedivision\amos\documenti\models\Documenti' => '@vendor/elitedivision/amos-comments/src/views/comment/email/content_title_documenti' // 'arter\amos\documenti\models\Documenti' => '@vendor/arter/amos-comments/src/views/comment/email/content_title_documenti'
// ]; // ];
/* /*
* *
*/ */
public $htmlMailContentTitleDefault = '@vendor/elitedivision/amos-comments/src/views/comment/email/content_title'; public $htmlMailContentTitleDefault = '@vendor/arter/amos-comments/src/views/comment/email/content_title';
/** /**
* This is the html used to render the message of the e-mail. In the view is available the variable $profile * This is the html used to render the message of the e-mail. In the view is available the variable $profile
* that is an instance of 'elitedivision\amos\admin\models\UserProfile' * that is an instance of 'arter\amos\admin\models\UserProfile'
* @var string|array * @var string|array
*/ */
public $htmlMailContent = '@vendor/elitedivision/amos-comments/src/views/comment/email/content'; public $htmlMailContent = '@vendor/arter/amos-comments/src/views/comment/email/content';
// public $htmlMailContent = [ // public $htmlMailContent = [
// 'elitedivision\amos\news\models\News' => '@vendor/elitedivision/amos-comments/src/views/comment/email/content_news', // 'arter\amos\news\models\News' => '@vendor/arter/amos-comments/src/views/comment/email/content_news',
// 'elitedivision\amos\discussioni\models\DiscussioniTopic' => '@vendor/elitedivision/amos-comments/src/views/comment/email/content_discussioni', // 'arter\amos\discussioni\models\DiscussioniTopic' => '@vendor/arter/amos-comments/src/views/comment/email/content_discussioni',
// 'elitedivision\amos\documenti\models\Documenti' => '@vendor/elitedivision/amos-comments/src/views/comment/email/content_documenti' // 'arter\amos\documenti\models\Documenti' => '@vendor/arter/amos-comments/src/views/comment/email/content_documenti'
// ]; // ];
/* /*
* *
*/ */
public $htmlMailContentDefault = '@vendor/elitedivision/amos-comments/src/views/comment/email/content'; public $htmlMailContentDefault = '@vendor/arter/amos-comments/src/views/comment/email/content';
/** /**
* Sets if the notify checkbox must be visible into the comments accordion * Sets if the notify checkbox must be visible into the comments accordion
* @var bool * @var bool
...@@ -148,9 +144,9 @@ class AmosComments extends AmosModule implements ModuleInterface, BootstrapInter ...@@ -148,9 +144,9 @@ class AmosComments extends AmosModule implements ModuleInterface, BootstrapInter
/** /**
* Example: * Example:
* [ * [
* 'elitedivision\amos\documenti\models\Documenti', * 'arter\amos\documenti\models\Documenti',
* 'elitedivision\amos\news\models\News', * 'arter\amos\news\models\News',
* 'elitedivision\amos\discussioni\models\Discussioni', * 'arter\amos\discussioni\models\Discussioni',
* ] * ]
* *
* @var boolean * @var boolean
...@@ -171,7 +167,7 @@ class AmosComments extends AmosModule implements ModuleInterface, BootstrapInter ...@@ -171,7 +167,7 @@ class AmosComments extends AmosModule implements ModuleInterface, BootstrapInter
public function init() public function init()
{ {
parent::init(); parent::init();
\Yii::setAlias('@elitedivision/amos/'.static::getModuleName().'/controllers', __DIR__.'/controllers/'); \Yii::setAlias('@arter/amos/'.static::getModuleName().'/controllers', __DIR__.'/controllers/');
// custom initialization code goes here // custom initialization code goes here
\Yii::configure($this, require(__DIR__.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php')); \Yii::configure($this, require(__DIR__.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'));
} }
...@@ -225,7 +221,7 @@ class AmosComments extends AmosModule implements ModuleInterface, BootstrapInter ...@@ -225,7 +221,7 @@ class AmosComments extends AmosModule implements ModuleInterface, BootstrapInter
->andWhere(['context' => $model->className(), 'context_id' => $model->id]) ->andWhere(['context' => $model->className(), 'context_id' => $model->id])
->groupBy('comment.id'); ->groupBy('comment.id');
/** @var \elitedivision\amos\comments\models\Comment $lastComment */ /** @var \arter\amos\comments\models\Comment $lastComment */
$countComment = $query->count(); $countComment = $query->count();
$query = Comment::find() $query = Comment::find()
->joinWith('commentReplies', true, 'LEFT JOIN') ->joinWith('commentReplies', true, 'LEFT JOIN')
......
<?php <?php
/** /**
* Lombardia Informatica S.p.A. * Emilia Romagna Open Innovation
* OPEN 2.0 * 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\comments\assets * @package arter\amos\comments\assets
* @category CategoryName * @category CategoryName
* @author Lombardia Informatica S.p.A.
*/ */
namespace elitedivision\amos\comments\assets; namespace arter\amos\comments\assets;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**
* Class CommentsAsset * Class CommentsAsset
* @package elitedivision\amos\comments\assets * @package arter\amos\comments\assets
*/ */
class CommentsAsset extends AssetBundle class CommentsAsset extends AssetBundle
{ {
/** /**
* @inheritdoc * @inheritdoc
*/ */
public $sourcePath = '@vendor/elitedivision/amos-comments/src/assets/web'; public $sourcePath = '@vendor/arter/amos-comments/src/assets/web';
/** /**
* @inheritdoc * @inheritdoc
...@@ -53,9 +49,9 @@ class CommentsAsset extends AssetBundle ...@@ -53,9 +49,9 @@ class CommentsAsset extends AssetBundle
{ {
$moduleL = \Yii::$app->getModule('layout'); $moduleL = \Yii::$app->getModule('layout');
if (!empty($moduleL)) { if (!empty($moduleL)) {
$this->depends [] = 'elitedivision\amos\layout\assets\BaseAsset'; $this->depends [] = 'arter\amos\layout\assets\BaseAsset';
} else { } else {
$this->depends [] = 'elitedivision\amos\core\views\assets\AmosCoreAsset'; $this->depends [] = 'arter\amos\core\views\assets\AmosCoreAsset';
} }
parent::init(); // TODO: Change the autogenerated stub parent::init(); // TODO: Change the autogenerated stub
} }
......
<?php <?php
/** /**
* Lombardia Informatica S.p.A. * Emilia Romagna Open Innovation
* OPEN 2.0 * 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\comments\assets * @package arter\amos\comments\assets
* @category CategoryName * @category CategoryName
* @author Lombardia Informatica S.p.A.
*/ */
namespace elitedivision\amos\comments\assets; namespace arter\amos\comments\assets;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**
* Class CommentsAsset * Class CommentsAsset
* @package elitedivision\amos\comments\assets * @package arter\amos\comments\assets
*/ */
class CommentsBootstrapitaliaAsset extends AssetBundle class CommentsBootstrapitaliaAsset extends AssetBundle
{ {
/** /**
* @inheritdoc * @inheritdoc
*/ */
public $sourcePath = '@vendor/elitedivision/amos-comments/src/assets/web'; public $sourcePath = '@vendor/arter/amos-comments/src/assets/web';
/** /**
* @inheritdoc * @inheritdoc
......
/** /**
IMPORT AMOS-LAYOUT VARIABLES IMPORT AMOS-LAYOUT VARIABLES
*/ */
@import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/variables.less"; @import (optional) "../../vendor/arter/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/utility.less";
/** /**
IMPORT STYLE-CUSTOM IMPORT STYLE-CUSTOM
*/ */
......
<?php <?php
/** /**
* Lombardia Informatica S.p.A. * Emilia Romagna Open Innovation
* OPEN 2.0 * 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\comments\base * @package arter\amos\comments\base
* @category CategoryName * @category CategoryName
* @author Lombardia Informatica S.p.A.
*/ */
namespace elitedivision\amos\comments\base; namespace arter\amos\comments\base;
use elitedivision\amos\comments\AmosComments; use arter\amos\comments\AmosComments;
use elitedivision\amos\comments\models\Comment; use arter\amos\comments\models\Comment;
use elitedivision\amos\comments\models\CommentNotification; use arter\amos\comments\models\CommentNotification;
use elitedivision\amos\comments\models\CommentReply; use arter\amos\comments\models\CommentReply;
use elitedivision\amos\comments\utility\CommentsUtility; use arter\amos\comments\utility\CommentsUtility;
use elitedivision\amos\core\controllers\CrudController; use arter\amos\core\controllers\CrudController;
use elitedivision\amos\core\interfaces\ModelLabelsInterface; use arter\amos\core\interfaces\ModelLabelsInterface;
use elitedivision\amos\core\record\Record; use arter\amos\core\record\Record;
use elitedivision\amos\core\user\User; use arter\amos\core\user\User;
use elitedivision\amos\core\utilities\Email; use arter\amos\core\utilities\Email;
use Yii; use Yii;
use yii\base\BaseObject; use yii\base\BaseObject;
use yii\helpers\ArrayHelper; use yii\helpers\ArrayHelper;
use elitedivision\amos\comments\models\CommentNotificationUsers; use arter\amos\comments\models\CommentNotificationUsers;
use elitedivision\amos\admin\models\UserProfile; use arter\amos\admin\models\UserProfile;
use yii\helpers\VarDumper; use yii\helpers\VarDumper;
/** /**
* Class PartecipantsNotification * Class PartecipantsNotification
* @package elitedivision\amos\comments\base * @package arter\amos\comments\base
*/ */
class PartecipantsNotification extends BaseObject class PartecipantsNotification extends BaseObject
{ {
...@@ -72,9 +68,9 @@ class PartecipantsNotification extends BaseObject ...@@ -72,9 +68,9 @@ class PartecipantsNotification extends BaseObject
$model_reply = $comment; $model_reply = $comment;
} }
/** @var \elitedivision\amos\core\record\Record $contextModelClassName */ /** @var \arter\amos\core\record\Record $contextModelClassName */
$contextModelClassName = $model->context; $contextModelClassName = $model->context;
/** @var \elitedivision\amos\core\record\Record $contextModel */ /** @var \arter\amos\core\record\Record $contextModel */
$contextModel = $contextModelClassName::findOne($model->context_id); $contextModel = $contextModelClassName::findOne($model->context_id);
$users = $this->getRecipients($contextModel, $contextModelClassName); $users = $this->getRecipients($contextModel, $contextModelClassName);
...@@ -105,7 +101,7 @@ class PartecipantsNotification extends BaseObject ...@@ -105,7 +101,7 @@ class PartecipantsNotification extends BaseObject
* notify_tagging_user_in_content = 0 * notify_tagging_user_in_content = 0
* *
* @param array | custom type list | $users * @param array | custom type list | $users
* @param model | elitedivision\amos\comments\models\base\Comment | $comment * @param model | arter\amos\comments\models\base\Comment | $comment
* *
* @return array | custom type list | $users * @return array | custom type list | $users
*/ */
...@@ -173,8 +169,8 @@ class PartecipantsNotification extends BaseObject ...@@ -173,8 +169,8 @@ class PartecipantsNotification extends BaseObject
$users = []; $users = [];
// If the context is discussion, the emails must be sent to the participants in the scope. // If the context is discussion, the emails must be sent to the participants in the scope.