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

General Bug Fixes and Improvements

parent a0abee1b
......@@ -6,10 +6,10 @@ Translation management.
Insert in config/component-amos
```php
'view' => [
'class' => 'elitedivision\amos\core\components\AmosView',
'class' => 'arter\amos\core\components\AmosView',
'theme' => [
'pathMap' => [
'@vendor/lajax/yii2-translate-manager/views/language/' => '@vendor/elitedivision/amos-translation/src/views/translatemanager/'
'@vendor/lajax/yii2-translate-manager/views/language/' => '@vendor/arter/amos-translation/src/views/translatemanager/'
],
],
],
......@@ -21,7 +21,7 @@ Insert in config/component-amos
Default language to translate if the record translate is not present
```php
'translation' => [
'class' => 'elitedivision\amos\translation\AmosTranslation',
'class' => 'arter\amos\translation\AmosTranslation',
'defaultTranslationLanguage' => 'en-GB',
],
```
......
{
"name": "elitedivision/amos-translation",
"name": "arter/amos-translation",
"description": "AMOS Translation",
"keywords": ["amos", "yii2", "translation"],
"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-workflow"
"source": "https://github.com/arter/amos-workflow"
},
"minimum-stability": "dev",
"require": {
"php": ">=5.5.0",
"elitedivision/amos-core":">=1.9.50",
"elitedivision/amos-dashboard": ">=1.8.15",
"elitedivision/amos-workflow": "*",
"arter/amos-core":">=1.9.50",
"arter/amos-dashboard": ">=1.8.15",
"arter/amos-workflow": "*",
"lajax/yii2-translate-manager": "1.*"
},
"extra": {
......@@ -27,7 +27,7 @@
},
"autoload": {
"psr-4": {
"elitedivision\\amos\\translation\\": "src"
"arter\\amos\\translation\\": "src"
}
}
}
<?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\translation
* @package arter\amos\translation
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\translation;
namespace arter\amos\translation;
use elitedivision\amos\core\module\Module;
use elitedivision\amos\core\module\AmosModule;
use elitedivision\amos\core\module\ModuleInterface;
use elitedivision\amos\core\record\Record;
use arter\amos\core\module\Module;
use arter\amos\core\module\AmosModule;
use arter\amos\core\module\ModuleInterface;
use arter\amos\core\record\Record;
use yii\web\Application;
use yii\base\BootstrapInterface;
use Yii;
......@@ -27,7 +23,7 @@ use yii\helpers\FileHelper;
/**
* Class AmosWorkflow
* @package elitedivision\amos\workflow
* @package arter\amos\workflow
*/
class AmosTranslation extends AmosModule implements BootstrapInterface
{
......@@ -43,7 +39,7 @@ class AmosTranslation extends AmosModule implements BootstrapInterface
public $newFileMode = 0666;
public $newDirMode = 0777;
public $languageField = 'language';
public $controllerNamespace = 'elitedivision\amos\translation\controllers';
public $controllerNamespace = 'arter\amos\translation\controllers';
/**
* It set the language source, if is set every saved record is copied in the translation language default
......@@ -116,7 +112,7 @@ class AmosTranslation extends AmosModule implements BootstrapInterface
* ```php
* 'modules' => [
* 'translation' => [
* 'class' => 'elitedivision\amos\translation\AmosTranslation',
* 'class' => 'arter\amos\translation\AmosTranslation',
* 'translationBootstrap' => [
* 'configuration' => [
* 'translationLabels' => [
......@@ -131,12 +127,12 @@ class AmosTranslation extends AmosModule implements BootstrapInterface
* ],
* ],
* 'translationContents' => [
* 'classBehavior' => \elitedivision\amos\translation\behaviors\TranslateableBehavior::className(),
* 'classBehavior' => \arter\amos\translation\behaviors\TranslateableBehavior::className(),
* 'models' => [
* [
* 'namespace' => 'backend\modules\id_plugin\models\NameModel',
* //'connection' => 'db', //if not set it use 'db'
* //'classBehavior' => null,//if not set it use default classBehavior 'elitedivision\amos\translation\behaviors\TranslateableBehavior'
* //'classBehavior' => null,//if not set it use default classBehavior 'arter\amos\translation\behaviors\TranslateableBehavior'
* //'enableWorkflow' => false,//if not set it use default configuration of the plugin
* //'workflow' => 'AmosTranslationWorkflow',
* //'view' => '@backend/modules/module/controller/view,
......@@ -164,8 +160,8 @@ class AmosTranslation extends AmosModule implements BootstrapInterface
* ```php
* 'bootstrap' => [
* 'translation',
* 'elitedivision\amos\translation\bootstrap\EventActiveRecordBootstrap',//fot the translation of the records
* 'elitedivision\amos\translation\bootstrap\EventViewBootstrap',//for the widget in the view file
* 'arter\amos\translation\bootstrap\EventActiveRecordBootstrap',//fot the translation of the records
* 'arter\amos\translation\bootstrap\EventViewBootstrap',//for the widget in the view file
* ],
* ```
*/
......@@ -177,7 +173,7 @@ class AmosTranslation extends AmosModule implements BootstrapInterface
public $eventViewBlackListModels = [];
public $eventViewWhiteListParts = ['_form'];
public $enableWidgetView = true;
public $widgetViewFile = '@vendor/elitedivision/amos-translation/src/views/default/language_status.php';
public $widgetViewFile = '@vendor/arter/amos-translation/src/views/default/language_status.php';
public $actionLanguage = '/translation/default/language';
public $numberGridViewField = 3;
public $enableRTE = true;
......@@ -187,7 +183,7 @@ class AmosTranslation extends AmosModule implements BootstrapInterface
* Model base class will be generated
* @var string
*/
public $modelBaseClass = 'elitedivision\\amos\\core\\record\\Record';
public $modelBaseClass = 'arter\\amos\\core\\record\\Record';
public $modelNs = "backend\\models\\translations";
public $modelGenerateRelation = 'all';
......@@ -266,7 +262,7 @@ class AmosTranslation extends AmosModule implements BootstrapInterface
{
parent::init();
\Yii::setAlias('@elitedivision/amos/'.static::getModuleName().'/controllers', __DIR__.'/controllers');
\Yii::setAlias('@arter/amos/'.static::getModuleName().'/controllers', __DIR__.'/controllers');
// initialize the module with the configuration loaded from config.php
Yii::configure($this, require(__DIR__.DIRECTORY_SEPARATOR.self::$CONFIG_FOLDER.DIRECTORY_SEPARATOR.'config.php'));
$this->configTranslationLabelsByModules();
......@@ -309,12 +305,12 @@ class AmosTranslation extends AmosModule implements BootstrapInterface
'@app',
'@backend',
'@frontend',
'@vendor/elitedivision/',
'@vendor/arter/',
]);
$configuration['scanRootParentDirectory'] = (isset($this->module_translation_labels_options['scanRootParentDirectory'])
? $this->module_translation_labels_options['scanRootParentDirectory'] : true);
$configuration['layout'] = (isset($this->module_translation_labels_options['layout']) ? $this->module_translation_labels_options['layout']
: '@vendor/elitedivision/amos-layout/src/views/layouts/main');
: '@vendor/arter/amos-layout/src/views/layouts/main');
$configuration['allowedIPs'] = (isset($this->module_translation_labels_options['allowedIPs']) ? $this->module_translation_labels_options['allowedIPs']
: ['*']);
$configuration['roles'] = (isset($this->module_translation_labels_options['roles']) ? $this->module_translation_labels_options['roles']
......
<?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\chat
* @package arter\amos\chat
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\translation\assets;
namespace arter\amos\translation\assets;
use yii\web\AssetBundle;
/**
* Class AmosChatAsset
* @package elitedivision\amos\chat\assets
* @package arter\amos\chat\assets
*/
class AmosTranslationAsset extends AssetBundle
{
/**
* @var string
*/
public $sourcePath = '@vendor/elitedivision/amos-translation/src/assets/web';
public $sourcePath = '@vendor/arter/amos-translation/src/assets/web';
/**
* @var array
......@@ -43,6 +39,6 @@ class AmosTranslationAsset extends AssetBundle
* @var array
*/
public $depends = [
'elitedivision\amos\core\views\assets\AmosCoreAsset',
'arter\amos\core\views\assets\AmosCoreAsset',
];
}
\ No newline at end of file
<?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\translation
* @package arter\amos\translation
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\translation\behaviors;
namespace arter\amos\translation\behaviors;
use Yii;
use yii\base\Behavior;
......@@ -20,7 +16,7 @@ use yii\base\Event;
use yii\db\ActiveRecord;
use yii\helpers\FileHelper;
use yii\helpers\StringHelper;
use elitedivision\amos\core\record\CachedActiveQuery;
use arter\amos\core\record\CachedActiveQuery;
class TranslateableBehavior extends Behavior
{
......@@ -324,7 +320,7 @@ class TranslateableBehavior extends Behavior
$languages = [];
$module = \Yii::$app->getModule('translation');
$result = true;
$languages = \elitedivision\amos\translation\models\TranslationConf::getStaticAllActiveLanguages($module->byPassPermissionInlineTranslation)->asArray()->all();
$languages = \arter\amos\translation\models\TranslationConf::getStaticAllActiveLanguages($module->byPassPermissionInlineTranslation)->asArray()->all();
$defaultLanguage = (!empty($this->defaultLanguage) ? $this->defaultLanguage : null);
if ($delete) {
if ($this->afterDeleteSource == self::DELETE_ONLY_LANGUAGE_SELECTED) {
......@@ -674,8 +670,8 @@ class TranslateableBehavior extends Behavior
*/
public static function getMappedLanguage($language)
{
if (method_exists('elitedivision\amos\core\i18n\MessageSource', 'getMappedLanguage')) {
return \elitedivision\amos\core\i18n\MessageSource::getMappedLanguage($language);
if (method_exists('arter\amos\core\i18n\MessageSource', 'getMappedLanguage')) {
return \arter\amos\core\i18n\MessageSource::getMappedLanguage($language);
}
return $language;
}
......
<?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\translation
* @package arter\amos\translation
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\translation\bootstrap;
namespace arter\amos\translation\bootstrap;
use elitedivision\amos\translation\AmosTranslation;
use elitedivision\amos\translation\models\LanguageTranslateUserFields;
use arter\amos\translation\AmosTranslation;
use arter\amos\translation\models\LanguageTranslateUserFields;
use Yii;
use yii\base\Event;
use yii\db\ActiveRecord;
......@@ -23,7 +19,7 @@ use yii\helpers\FileHelper;
/**
* Class EventActiveRecordBootstrap
* @package elitedivision\amos\translation\bootstrap
* @package arter\amos\translation\bootstrap
*/
class EventActiveRecordBootstrap extends \yii\db\ActiveRecord
{
......
<?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\translation
* @package arter\amos\translation
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\translation\bootstrap;
namespace arter\amos\translation\bootstrap;
use Yii;
use yii\base\Application;
use yii\helpers\FileHelper;
use elitedivision\amos\translation\models\TranslationConf;
use elitedivision\amos\translation\AmosTranslation;
use arter\amos\translation\models\TranslationConf;
use arter\amos\translation\AmosTranslation;
/**
* Class TranslationBootstrap: <br />
......@@ -54,7 +50,7 @@ class EventViewBootstrap extends \yii\web\View
$modelsEnabled = [];
$blackListModels = array_merge([
'elitedivision\amos\translation\bootstrap\EventViewBootstrap',
'arter\amos\translation\bootstrap\EventViewBootstrap',
], $moduleTranslation->eventViewBlackListModels);
$blackListViews = array_merge([
......
<?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\translation
* @package arter\amos\translation
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\translation\components;
namespace arter\amos\translation\components;
use Yii;
use yii\gii\CodeFile;
......
<?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\translation
* @package arter\amos\translation
* @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\translation
* @package arter\amos\translation
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
return [
......
<?php
namespace elitedivision\amos\translation\controllers;
namespace arter\amos\translation\controllers;
use elitedivision\amos\translation\utility\TranslationUtility;
use arter\amos\translation\utility\TranslationUtility;
use Yii;
use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use yii\web\Cookie;
use elitedivision\amos\translation\models\TranslationConf;
use arter\amos\translation\models\TranslationConf;
use yii\data\ActiveDataProvider;
use yii\helpers\StringHelper;
use yii\helpers\Inflector;
use elitedivision\amos\translation\AmosTranslation;
use arter\amos\translation\AmosTranslation;
use yii\helpers\Url;
use elitedivision\amos\admin\models\UserProfile;
use elitedivision\amos\translation\models\TranslationUserLanguageMm;
use arter\amos\admin\models\UserProfile;
use arter\amos\translation\models\TranslationUserLanguageMm;
use yii\web\ForbiddenHttpException;
use elitedivision\amos\core\record\CachedActiveQuery;
use arter\amos\core\record\CachedActiveQuery;
/**
* Translation controller
......@@ -195,7 +195,7 @@ class DefaultController extends Controller
$model = new TranslationUserLanguageMm();
}
$languages = \elitedivision\amos\translation\models\TranslationUserLanguageMm::find()
$languages = \arter\amos\translation\models\TranslationUserLanguageMm::find()
->andWhere(['user_id' => $user_id])
->select('language');
$lngs = [];
......@@ -231,7 +231,7 @@ class DefaultController extends Controller
$lang = $this->verifyLang($lang);
$modelSearch = new \elitedivision\amos\translation\models\search\TranslationSearch();
$modelSearch = new \arter\amos\translation\models\search\TranslationSearch();
$model = new $classNameTrans;
$pkSource = \Yii::$app->{$module->dbSource}->getTableSchema($namespace::tableName())->primaryKey;
......@@ -473,7 +473,7 @@ class DefaultController extends Controller
$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
namespace elitedivision\amos\translation\controllers;
namespace arter\amos\translation\controllers;
use Yii;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use yii\helpers\Url;
use elitedivision\amos\dashboard\controllers\base\DashboardController;
use arter\amos\dashboard\controllers\base\DashboardController;
/**
* Translation controller
......@@ -76,7 +76,7 @@ class TranslateController 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
namespace elitedivision\amos\translation\controllers;
namespace arter\amos\translation\controllers;
use elitedivision\amos\core\helpers\BreadcrumbHelper;
use arter\amos\core\helpers\BreadcrumbHelper;
use Yii;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use yii\helpers\FileHelper;
use yii\helpers\Url;
use elitedivision\amos\dashboard\controllers\base\DashboardController;
use arter\amos\dashboard\controllers\base\DashboardController;
use yii\web\Controller;
use elitedivision\amos\translation\AmosTranslation;
use arter\amos\translation\AmosTranslation;
/**
* Translation controller
......
<?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\translation\i18n\en-GB
* @package arter\amos\translation\i18n\en-GB
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
return [
'Aggiornato da' => 'Updated by',
......
<?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\translation\i18n\en-US
* @package arter\amos\translation\i18n\en-US
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
return [
'Aggiornato da' => 'Updated by',
......
<?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\translation\i18n\it-IT
* @package arter\amos\translation\i18n\it-IT
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
return [
'Aggiornato da' => 'Aggiornato da',
......
<?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\translation\migrations
* @package arter\amos\translation\migrations
* @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\translation\migrations
* @package arter\amos\translation\migrations
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
/**
......