Merge pull request #3225 from acs-ferreira/patch-5

Simple clean
This commit is contained in:
Lucas Bartholemy 2018-08-07 12:19:41 +02:00 committed by GitHub
commit c989b24743
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 57 additions and 44 deletions

View File

@ -8,7 +8,6 @@
namespace humhub\modules\activity\controllers;
use humhub\modules\activity\actions\ActivityStreamAction;
use humhub\modules\content\components\ContentContainerController;

View File

@ -10,10 +10,10 @@ namespace humhub\modules\activity\models;
use Yii;
use yii\base\Exception;
use yii\db\ActiveRecord;
use humhub\modules\content\components\ContentActiveRecord;
use humhub\modules\activity\components\ActivityWebRenderer;
use humhub\components\behaviors\PolymorphicRelation;
use yii\db\ActiveRecord;
/**
* This is the model class for table "activity".

View File

@ -9,8 +9,12 @@
use yii\helpers\Html;
?>
---
<?= $content; ?> <?php if (isset($record->content->space) && $record->content->space !== null): ?>(<?= strip_tags(Yii::t('ActivityModule.views_activityLayoutMail', 'via')); ?> <?= Html::encode($record->content->space->name); ?>)
<?php endif; ?><?php if ($url != "") : ?><?= strip_tags(Yii::t('ActivityModule.views_activityLayoutMail', 'See online:')); ?> <?= urldecode($url); ?><?php endif; ?>
<?= $content; ?>
<?php if (isset($record->content->space) && $record->content->space !== null) : ?>
(<?= strip_tags(Yii::t('ActivityModule.views_activityLayoutMail', 'via')); ?> <?= Html::encode($record->content->space->name); ?>)
<?php endif; ?>
<?php if ($url != '') : ?>
<?= strip_tags(Yii::t('ActivityModule.views_activityLayoutMail', 'See online:')); ?> <?= urldecode($url); ?>
<?php endif; ?>

View File

@ -10,11 +10,11 @@ use humhub\modules\content\components\ContentContainerController;
use humhub\modules\space\models\Space;
use humhub\modules\space\widgets\Image;
use humhub\widgets\TimeAgo;
use yii\helpers\Url;
?>
<?php if ($clickable) : ?>
<a href="<?= \yii\helpers\Url::to(['/activity/link', 'id' => $record->id])?>">
<a href="<?= Url::to(['/activity/link', 'id' => $record->id])?>">
<?php endif; ?>
<li class="activity-entry" data-stream-entry data-action-component="activity.ActivityStreamEntry" data-content-key="<?= $record->content->id ?>">
<div class="media">
@ -44,12 +44,14 @@ use humhub\widgets\TimeAgo;
<div class="media-body text-break">
<!-- Show content -->
<?= $content; ?><br>
<?= $content; ?>
<br>
<!-- show time -->
<?= TimeAgo::widget(['timestamp' => $record->content->created_at]); ?>
</div>
</div>
</li>
<?php if ($clickable) : ?></a>
<?php endif; ?>
<?php if ($clickable) : ?>
</a>
<?php endif; ?>

View File

@ -8,30 +8,29 @@
?>
<tr>
<td align="center" valign="top" class="fix-box">
<td align="center" valign="top" class="fix-box">
<!-- start container width 600px -->
<table width="600" align="center" border="0" cellspacing="0" cellpadding="0" class="container" style="background-color:<?= Yii::$app->view->theme->variable('background-color-main', '#fff') ?>; border-top-left-radius: 4px; border-top-right-radius: 4px;">
<table width="600" align="center" border="0" cellspacing="0" cellpadding="0" class="container" style="background-color:<?= Yii::$app->view->theme->variable('background-color-main', '#fff') ?>; border-top-left-radius: 4px; border-top-right-radius: 4px;">
<tr>
<td valign="top">
<!-- start container width 560px -->
<table width="560" align="center" border="0" cellspacing="0" cellpadding="0" class="full-width" style="background-color:<?= Yii::$app->view->theme->variable('background-color-main', '#fff') ?>;">
<table width="560" align="center" border="0" cellspacing="0" cellpadding="0" class="full-width" style="background-color:<?= Yii::$app->view->theme->variable('background-color-main', '#fff') ?>;">
<!-- start image content -->
<tr>
<td valign="top" width="100%">
<!-- start content left -->
<table width="270" border="0" cellspacing="0" cellpadding="0" align="left" class="full-width" >
<table width="270" border="0" cellspacing="0" cellpadding="0" align="left" class="full-width">
<!-- start text content -->
<tr>
<td valign="top">
<table border="0" cellspacing="0" cellpadding="0" align="left" >
<table border="0" cellspacing="0" cellpadding="0" align="left">
<tr>
<td style="font-size: 18px; line-height: 22px; font-family:Open Sans, Arial,Tahoma, Helvetica, sans-serif; font-weight:300; text-align:left;">
<td style="font-size: 18px; line-height: 22px; font-family:Open Sans, Arial, Tahoma, Helvetica, sans-serif; font-weight:300; text-align:left;">
<span style="color:<?= Yii::$app->view->theme->variable('text-color-highlight', '#555') ?>; font-weight: 300;">
<a href="#" style="text-decoration: none; color:<?= Yii::$app->view->theme->variable('text-color-highlight', '#555') ?>; font-weight: 300;">
<?= Yii::t('base', '<strong>Mail</strong> summary'); ?>
@ -52,7 +51,6 @@
</table>
<!-- end content left -->
</td>
</tr>
<!-- end image content -->
@ -66,4 +64,4 @@
</td>
</tr>
<?= $activities; ?>
<?= $activities; ?>

View File

@ -5,5 +5,6 @@
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
?><?= strip_tags(Yii::t('base', '<strong>Latest</strong> updates')); ?>
<?= $activitiesPlaintext; ?>
?>
<?= strip_tags(Yii::t('base', '<strong>Latest</strong> updates')); ?>
<?= $activitiesPlaintext; ?>

View File

@ -1,6 +1,5 @@
<?php
namespace humhub\modules\activity\widgets;
/**
@ -12,11 +11,12 @@ class Stream extends ActivityStreamViewer
{
public function init()
{
if($this->streamAction == '/dashboard/dashboard/stream') {
if ($this->streamAction == '/dashboard/dashboard/stream') {
$this->streamAction = '/dashboard/dashboard/activity-stream';
} elseif($this->streamAction === '/space/space/stream') {
} elseif ($this->streamAction === '/space/space/stream') {
$this->streamAction = '/activity/stream/stream';
}
parent::init();
}

View File

@ -9,13 +9,15 @@
namespace humhub\modules\search;
use Yii;
use yii\base\BaseObject;
use yii\helpers\Console;
/**
* Description of SearchModuleEvents
*
* @author luke
*/
class Events extends \yii\base\BaseObject
class Events extends BaseObject
{
public static function onTopMenuRightInit($event)
@ -35,14 +37,13 @@ class Events extends \yii\base\BaseObject
public static function onHourlyCron($event)
{
$controller = $event->sender;
$controller->stdout("Optimizing search index... ");
$controller->stdout('Optimizing search index...');
Yii::$app->search->optimize();
$controller->stdout('done.' . PHP_EOL, \yii\helpers\Console::FG_GREEN);
$controller->stdout('done.' . PHP_EOL, Console::FG_GREEN);
}
public static function onConsoleApplicationInit($event)
{
$application = $event->sender;
$application->controllerMap['search'] = commands\SearchController::class;
}

View File

@ -12,6 +12,7 @@ use Yii;
use yii\db\ActiveRecord;
use yii\base\Behavior;
use yii\console\Exception;
use humhub\modules\search\interfaces\Searchable as SearchableInterface;
/**
* Searchable Behavior
@ -35,19 +36,19 @@ class Searchable extends Behavior
public function afterSave($event)
{
if ($this->owner instanceof \humhub\modules\search\interfaces\Searchable) {
if ($this->owner instanceof SearchableInterface) {
Yii::$app->search->update($this->owner);
} else {
throw new Exception("Owner of HSearchableBehavior must be implement interface ISearchable");
throw new Exception('Owner of HSearchableBehavior must be implement interface ISearchable');
}
}
public function afterDelete($event)
{
if ($this->owner instanceof \humhub\modules\search\interfaces\Searchable) {
if ($this->owner instanceof SearchableInterface) {
Yii::$app->search->delete($this->owner);
} else {
throw new Exception("Owner of HSearchableBehavior must be implement interface ISearchable");
throw new Exception('Owner of HSearchableBehavior must be implement interface ISearchable');
}
}

View File

@ -18,4 +18,3 @@ return [
'search' => 'search/search/index',
]
];
?>

View File

@ -9,9 +9,11 @@
namespace humhub\modules\search\engine;
use Yii;
use yii\base\Component;
use humhub\modules\search\interfaces\Searchable;
use humhub\modules\content\models\Content;
use humhub\modules\content\components\ContentActiveRecord;
use humhub\modules\content\components\ContentContainerActiveRecord;
use humhub\modules\user\models\User;
use humhub\modules\space\models\Space;
use humhub\modules\search\events\SearchAttributesEvent;
@ -22,7 +24,7 @@ use humhub\modules\search\events\SearchAttributesEvent;
* @since 0.12
* @author luke
*/
abstract class Search extends \yii\base\Component
abstract class Search extends Component
{
const EVENT_SEARCH_ATTRIBUTES = 'search_attributes';
@ -111,7 +113,7 @@ abstract class Search extends \yii\base\Component
$meta['pk'] = $obj->getPrimaryKey();
$meta['model'] = $obj->className();
if ($obj instanceof \humhub\modules\content\components\ContentContainerActiveRecord) {
if ($obj instanceof ContentContainerActiveRecord) {
$meta['containerModel'] = $obj->className();
$meta['containerPk'] = $obj->id;
}
@ -151,11 +153,13 @@ abstract class Search extends \yii\base\Component
protected function setDefaultFindOptions($options)
{
if (!isset($options['page']) || $options['page'] == "")
if (!isset($options['page']) || $options['page'] == '') {
$options['page'] = 1;
}
if (!isset($options['pageSize']) || $options['pageSize'] == "")
if (!isset($options['pageSize']) || $options['pageSize'] == '') {
$options['pageSize'] = Yii::$app->settings->get('paginationSize');
}
if (!isset($options['checkPermissions'])) {
$options['checkPermissions'] = true;
@ -179,6 +183,7 @@ abstract class Search extends \yii\base\Component
{
$additionalAttributes = [];
$this->trigger(self::EVENT_SEARCH_ATTRIBUTES, new SearchAttributesEvent($additionalAttributes, $object));
return $additionalAttributes;
}

View File

@ -8,13 +8,15 @@
namespace humhub\modules\search\events;
use yii\base\Event;
/**
* This event is used when an object is added to search index
*
* @author luke
* @since 0.21
*/
class SearchAddEvent extends \yii\base\Event
class SearchAddEvent extends Event
{
/**

View File

@ -8,6 +8,8 @@
namespace humhub\modules\search\events;
use yii\base\Event;
/**
* This event is used to collect additional search attributes for a record.
*
@ -17,7 +19,7 @@ namespace humhub\modules\search\events;
* @author luke
* @since 1.2.3
*/
class SearchAttributesEvent extends \yii\base\Event
class SearchAttributesEvent extends Event
{
/**

View File

@ -8,12 +8,12 @@
namespace humhub\modules\search\widgets;
use yii\base\Widget;
/**
* SearchMenu Widget for TopMenu
*/
class SearchMenu extends \yii\base\Widget
class SearchMenu extends Widget
{
/**

View File

@ -1,16 +1,15 @@
<?php
use yii\helpers\Url;
?>
<li class="dropdown search-menu">
<a href="<?php echo Url::to(['/search/search/index']); ?>" id="search-menu" class="dropdown-toggle" aria-label="<?= Yii::t('SearchModule.views_search_index', 'Search for user, spaces and content') ?>">
<a href="<?= Url::to(['/search/search/index']); ?>" id="search-menu" class="dropdown-toggle" aria-label="<?= Yii::t('SearchModule.views_search_index', 'Search for user, spaces and content') ?>">
<i class="fa fa-search"></i>
</a>
</li>
<script type="text/javascript">
<script>
/**
* Open search menu
*/