diff --git a/protected/humhub/modules/file/Module.php b/protected/humhub/modules/file/Module.php index aa8413e34a..443fcfef61 100644 --- a/protected/humhub/modules/file/Module.php +++ b/protected/humhub/modules/file/Module.php @@ -38,4 +38,9 @@ class Module extends \humhub\components\Module 'image/jpeg' ]; + /** + * @var array of converter options + */ + public $converterOptions = []; + } diff --git a/protected/humhub/modules/file/converter/BaseConverter.php b/protected/humhub/modules/file/converter/BaseConverter.php index 02d1e8e8a6..9cd1b85928 100644 --- a/protected/humhub/modules/file/converter/BaseConverter.php +++ b/protected/humhub/modules/file/converter/BaseConverter.php @@ -8,6 +8,7 @@ namespace humhub\modules\file\converter; +use Yii; use humhub\modules\file\models\File; /** @@ -31,6 +32,18 @@ abstract class BaseConverter extends \yii\base\Object */ public $options = []; + /** + * @inheritdoc + */ + public function init() + { + parent::init(); + + if (!empty(Yii::$app->getModule('file')->converterOptions[$this->className()])) { + Yii::configure($this, Yii::$app->getModule('file')->converterOptions[$this->className()]); + } + } + /** * Convert file */ @@ -72,8 +85,8 @@ abstract class BaseConverter extends \yii\base\Object */ public function applyFile(File $file) { + $this->file = $file; if ($this->canConvert($file)) { - $this->file = $file; return true; } diff --git a/protected/humhub/modules/file/resources/js/humhub.file.js b/protected/humhub/modules/file/resources/js/humhub.file.js index 6376fefac8..3eca14ca1b 100644 --- a/protected/humhub/modules/file/resources/js/humhub.file.js +++ b/protected/humhub/modules/file/resources/js/humhub.file.js @@ -340,6 +340,13 @@ humhub.module('file', function (module, require, $) { Preview.prototype.add = function (file) { file.galleryId = this.$.attr('id') + '_file_preview_gallery'; var template = this.getTemplate(file); + + if(file.highlight) { + file.highlight = 'highlight'; + } else { + file.highlight = ''; + } + var $file = $(string.template(template, file)); if(this.source && this.source.options.uploadSingle) { @@ -446,8 +453,8 @@ humhub.module('file', function (module, require, $) { Preview.template = { root: '', file_edit: '', - file: '', - file_image: '', + file: '', + file_image: '', popover: '{name}' }; diff --git a/protected/humhub/modules/search/controllers/SearchController.php b/protected/humhub/modules/search/controllers/SearchController.php index 8e322fe078..8c69c5141d 100644 --- a/protected/humhub/modules/search/controllers/SearchController.php +++ b/protected/humhub/modules/search/controllers/SearchController.php @@ -2,7 +2,7 @@ /** * @link https://www.humhub.org/ - * @copyright Copyright (c) 2015 HumHub GmbH & Co. KG + * @copyright Copyright (c) 2017 HumHub GmbH & Co. KG * @license https://www.humhub.com/licences */ @@ -13,7 +13,6 @@ use humhub\components\Controller; use humhub\modules\space\models\Space; use humhub\modules\user\models\User; use humhub\modules\search\models\forms\SearchForm; - use humhub\modules\space\widgets\Image; /** @@ -24,6 +23,15 @@ use humhub\modules\space\widgets\Image; */ class SearchController extends Controller { + + /** + * @var string the current search keyword + */ + public static $keyword = null; + + /** + * @inheritdoc + */ public function init() { $this->appendPageTitle(\Yii::t('SearchModule.base', 'Search')); @@ -64,7 +72,7 @@ class SearchController extends Controller 'pageSize' => Yii::$app->settings->get('paginationSize'), 'limitSpaces' => $limitSpaces ]; - + if ($model->scope == SearchForm::SCOPE_CONTENT) { $options['type'] = \humhub\modules\search\engine\Search::DOCUMENT_TYPE_CONTENT; } elseif ($model->scope == SearchForm::SCOPE_SPACE) { @@ -77,16 +85,19 @@ class SearchController extends Controller $searchResultSet = Yii::$app->search->find($model->keyword, $options); + // store static for use in widgets (e.g. fileList) + self::$keyword = $model->keyword; + $pagination = new \yii\data\Pagination; $pagination->totalCount = $searchResultSet->total; $pagination->pageSize = $searchResultSet->pageSize; return $this->render('index', array( - 'model' => $model, - 'results' => $searchResultSet->getResultInstances(), - 'pagination' => $pagination, - 'totals' => $model->getTotals($model->keyword, $options), - 'limitSpaces' => $limitSpaces + 'model' => $model, + 'results' => $searchResultSet->getResultInstances(), + 'pagination' => $pagination, + 'totals' => $model->getTotals($model->keyword, $options), + 'limitSpaces' => $limitSpaces )); } @@ -117,4 +128,5 @@ class SearchController extends Controller return $results; } + } diff --git a/protected/humhub/modules/search/libs/SearchHelper.php b/protected/humhub/modules/search/libs/SearchHelper.php new file mode 100644 index 0000000000..c6fe5a2c3d --- /dev/null +++ b/protected/humhub/modules/search/libs/SearchHelper.php @@ -0,0 +1,39 @@ +