mirror of
https://github.com/humhub/humhub.git
synced 2025-03-14 20:19:47 +01:00
Merge branch 'develop' into enh/user-cli
This commit is contained in:
commit
83b4f7a3ea
@ -12,10 +12,9 @@ HumHub Changelog
|
||||
- Fix #4230: Auto enable "Hide file info (name, size) for images on wall" option
|
||||
- Chg: Move CHANGELOG to humhub root
|
||||
- Fix #4330: Allow users with permission ManageUsers to modify profile images
|
||||
- Enh #4331: Added 'break-all' stylesheet option to stream entry layouts
|
||||
- Enh #4179: Removed deprecated mysql character set in log table migration
|
||||
- Enh #4324: Improved line break for menu entries with many characters
|
||||
- Fix #4186: Add Timezone validation rules to admin prerequisite view
|
||||
- Enh #4186: Add Timezone validation rules to admin prerequisite view
|
||||
- Enh #4378: Implemented generic ContentContainerActiveRecord::is() function
|
||||
- Enh #4310: Add "Can Like" Permission
|
||||
- Fix #4111: Issues Cropping Images
|
||||
@ -39,12 +38,12 @@ HumHub Changelog
|
||||
- Enh #4401: Allow to use less variable name in value of another less variable
|
||||
- Fix #4434: Fix title quoting for space icons in widget “Member in these spaces”
|
||||
- Fix #4428: Replace db Expression time now with func date('Y-m-d G:i:s')
|
||||
- Enh #4370: Add "summary" to `Space` model
|
||||
- Enh #4370: Add "about" to `Space` model
|
||||
- Enh #4370: Add `humhub\modules\space\widgets\MyMembership` to manage render user state in a space
|
||||
- Enh #4370: Add `humhub\modules\space\widgets\AboutPageSidebar` to manage about page sidebar
|
||||
- Enh #4370: Add `About Space` page
|
||||
- Enh #3994: Live event legitimation array include followed users
|
||||
- Enh #3994: Live event legitimation consider `cached` argument in processing data
|
||||
- Fix #3994: Live event legitimation array include followed users
|
||||
- Fix #3994: Live event legitimation consider `cached` argument in processing data
|
||||
- Fix #4452: `humhub.ui.filter.getActiveFilterCount` returns wrong value with exclude array option
|
||||
- Fix #4452: Ignore `scope` profile filter in stream filter count and hasActiveFilters
|
||||
- Fix #4456: PHP8 deprecated warning for LessHelper::updateVariables()
|
||||
@ -61,4 +60,8 @@ HumHub Changelog
|
||||
- Enh #4476: Reworked TimeAgo widget
|
||||
- Chng #4482: Removed old legacy richtext editor which is deprecated since v1.3
|
||||
- Enh #4475: Add Console UserAdmin Command
|
||||
|
||||
- Chg #4482: Removed old legacy richtext editor which is deprecated since v1.3
|
||||
- Enh #3851: Migrate components from ZendFramework to Laminas
|
||||
- Fix #4354: Set `about` as target url of space invitation notification
|
||||
- Fix #4493: Removed legacy ControllerAccess in notification ListController
|
||||
- Chng #4509: Removed `humhub\modules\space\widgets\Picker` which is deprecated since v1.2
|
||||
|
@ -13,7 +13,7 @@
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"require": {
|
||||
"php": ">=7.0.0",
|
||||
"php": ">=7.1",
|
||||
"ext-exif": "*",
|
||||
"ext-zip": "*",
|
||||
"cebe/markdown": "1.0.2",
|
||||
@ -22,6 +22,9 @@
|
||||
"firebase/php-jwt": "^5.0",
|
||||
"jbroadway/urlify": "^1.0",
|
||||
"kartik-v/yii2-widgets": "*",
|
||||
"laminas/laminas-escaper": "^2.6",
|
||||
"laminas/laminas-ldap": "^2.10",
|
||||
"matthewbdaly/zendsearch": "^0.0.3",
|
||||
"mistic100/randomcolor": "^1.0",
|
||||
"npm-asset/animate.css": "*",
|
||||
"npm-asset/at.js": "^1.5.1",
|
||||
@ -47,7 +50,6 @@
|
||||
"npm-asset/socket.io-client": "^2.0",
|
||||
"npm-asset/swiped-events": "1.0.9",
|
||||
"npm-asset/timeago": "^1.6.3",
|
||||
"nqxcode/zendsearch": "^2.0",
|
||||
"phpoffice/phpspreadsheet": "^1.0",
|
||||
"raoul2000/yii2-jcrop-widget": "*",
|
||||
"twig/twig": "^1.0",
|
||||
@ -60,9 +62,9 @@
|
||||
"yiisoft/yii2-jui": "~2.0.0",
|
||||
"yiisoft/yii2-queue": "~2.3.0",
|
||||
"yiisoft/yii2-redis": "~2.0.0",
|
||||
"yiisoft/yii2-swiftmailer": "~2.0.0",
|
||||
"zendframework/zend-http": "*",
|
||||
"zendframework/zend-ldap": "^2.5"
|
||||
"yiisoft/yii2-swiftmailer": "~2.0.0"
|
||||
},
|
||||
"replace": {
|
||||
},
|
||||
"require-dev": {
|
||||
"codeception/codeception": "^4.0",
|
||||
@ -86,9 +88,6 @@
|
||||
],
|
||||
"config": {
|
||||
"process-timeout": 1800,
|
||||
"platform": {
|
||||
"php": "7.0"
|
||||
},
|
||||
"vendor-dir": "protected/vendor",
|
||||
"sort-packages": true,
|
||||
"fxp-asset": {
|
||||
|
3248
composer.lock
generated
3248
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,7 @@
|
||||
|
||||
namespace humhub\libs;
|
||||
|
||||
use humhub\widgets\Button;
|
||||
use yii\grid\Column;
|
||||
use yii\helpers\Url;
|
||||
use humhub\libs\Html;
|
||||
@ -52,7 +53,8 @@ class ActionColumn extends Column
|
||||
}
|
||||
|
||||
$html = Html::beginTag('div', ['class' => 'btn-group dropdown-navigation']);
|
||||
$html .= Html::button('<i class="fa fa-cog"></i> <span class="caret"></span>', ['class' => 'btn btn-default dropdown-toggle', 'data-toggle' => 'dropdown']);
|
||||
$html .= Button::defaultType('<span class="caret"></span>')->cssClass('dropdown-toggle')
|
||||
->options(['data-toggle' => 'dropdown'])->icon('controls')->loader(false);
|
||||
$html .= Html::beginTag('ul', ['class' => 'dropdown-menu pull-right']);
|
||||
foreach ($actions as $title => $url) {
|
||||
if ($url === '---') {
|
||||
@ -89,7 +91,7 @@ class ActionColumn extends Column
|
||||
|
||||
/**
|
||||
* Builds the URL for a given Action
|
||||
*
|
||||
*
|
||||
* @param array $url
|
||||
* @param \yii\base\Model $model
|
||||
* @return string the url
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
namespace humhub\libs;
|
||||
|
||||
use humhub\modules\ui\icon\widgets\Icon;
|
||||
use humhub\modules\web\security\helpers\Security;
|
||||
use Yii;
|
||||
use yii\base\InvalidArgumentException;
|
||||
@ -114,7 +115,7 @@ class Html extends \yii\bootstrap\Html
|
||||
}
|
||||
|
||||
if (!isset($options['showIcon']) || $options['showIcon'] === true) {
|
||||
$label = '<i class="fa fa-arrow-left aria-hidden="true"></i> ' . $label;
|
||||
$label = Icon::get('back')->asString().' '. $label;
|
||||
}
|
||||
|
||||
if (empty($url)) {
|
||||
|
@ -1,10 +1,16 @@
|
||||
<?php
|
||||
|
||||
use humhub\libs\Html;
|
||||
use humhub\modules\admin\widgets\GroupManagerMenu;
|
||||
use humhub\modules\user\models\Group;
|
||||
use humhub\widgets\Button;
|
||||
|
||||
/* @var $group Group */
|
||||
|
||||
?>
|
||||
<div class="panel-body">
|
||||
<div class="pull-right">
|
||||
<?= Html::backButton(['index'], ['label' => Yii::t('AdminModule.base', 'Back to overview')]); ?>
|
||||
<?= Button::back(['index'], Yii::t('AdminModule.base', 'Back to overview'))?>
|
||||
</div>
|
||||
|
||||
<?php if (!$group->isNewRecord) : ?>
|
||||
@ -22,7 +28,7 @@ use humhub\libs\Html;
|
||||
<?php if ($group->is_admin_group) : ?>
|
||||
<div class="pull-right"><span class="label label-danger"><?= Yii::t('AdminModule.base', 'Administrative group'); ?></span> </div>
|
||||
<?php endif; ?>
|
||||
<?= \humhub\modules\admin\widgets\GroupManagerMenu::widget(['group' => $group]); ?>
|
||||
<?= GroupManagerMenu::widget(['group' => $group]); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?= $content; ?>
|
||||
|
@ -1,14 +1,19 @@
|
||||
<?php
|
||||
|
||||
use humhub\libs\ActionColumn;
|
||||
use humhub\modules\admin\models\GroupSearch;
|
||||
use humhub\modules\admin\widgets\GroupMenu;
|
||||
use humhub\widgets\Link;
|
||||
use yii\helpers\Url;
|
||||
use yii\helpers\Html;
|
||||
use humhub\widgets\GridView;
|
||||
|
||||
/* @var $searchModel GroupSearch*/
|
||||
?>
|
||||
<div class="panel-body">
|
||||
<div class="pull-right">
|
||||
<?= Html::a('<i class="fa fa-plus" aria-hidden="true"></i> ' . Yii::t('AdminModule.user', 'Create new group'), Url::to(['edit']), ['class' => 'btn btn-sm btn-success']); ?>
|
||||
<?= Link::success(Yii::t('AdminModule.user', 'Create new group'))->href(Url::to(['edit']))->sm()->icon('add') ?>
|
||||
</div>
|
||||
|
||||
|
||||
<h4><?= Yii::t('AdminModule.user', 'Manage groups'); ?></h4>
|
||||
|
||||
<div class="help-block">
|
||||
@ -16,12 +21,11 @@ use humhub\widgets\GridView;
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?= \humhub\modules\admin\widgets\GroupMenu::widget(); ?>
|
||||
<?= GroupMenu::widget() ?>
|
||||
|
||||
<div class="panel-body">
|
||||
|
||||
<?php
|
||||
echo GridView::widget([
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'tableOptions' => ['class' => 'table table-hover'],
|
||||
@ -38,7 +42,7 @@ use humhub\widgets\GridView;
|
||||
}
|
||||
],
|
||||
[
|
||||
'class' => \humhub\libs\ActionColumn::class,
|
||||
'class' => ActionColumn::class,
|
||||
'actions' => function($group, $key, $index) {
|
||||
/* @var $group \humhub\modules\user\models\Group */
|
||||
if($group->is_admin_group && !Yii::$app->user->isAdmin()) {
|
||||
@ -54,6 +58,5 @@ use humhub\widgets\GridView;
|
||||
}
|
||||
],
|
||||
],
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
]) ?>
|
||||
</div>
|
||||
|
@ -1,33 +1,41 @@
|
||||
<?php
|
||||
|
||||
use humhub\modules\admin\assets\AdminGroupAsset;
|
||||
use humhub\modules\admin\models\forms\AddGroupMemberForm;
|
||||
use humhub\modules\admin\models\UserSearch;
|
||||
use humhub\modules\user\models\Group;
|
||||
use humhub\widgets\Button;
|
||||
use yii\helpers\Url;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use humhub\widgets\GridView;
|
||||
use humhub\modules\user\grid\ImageColumn;
|
||||
use humhub\modules\user\grid\DisplayNameColumn;
|
||||
use humhub\modules\user\widgets\UserPickerField;
|
||||
|
||||
\humhub\modules\admin\assets\AdminGroupAsset::register($this);
|
||||
/* @var $group Group */
|
||||
/* @var $addGroupMemberForm AddGroupMemberForm */
|
||||
/* @var $searchModel UserSearch */
|
||||
|
||||
AdminGroupAsset::register($this);
|
||||
?>
|
||||
|
||||
<?php $this->beginContent('@admin/views/group/_manageLayout.php', ['group' => $group]) ?>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<?php $form = ActiveForm::begin(['action' => ['/admin/group/add-members']]); ?>
|
||||
<div class="input-group select2-humhub-append">
|
||||
<?=
|
||||
humhub\modules\user\widgets\UserPickerField::widget([
|
||||
<?= UserPickerField::widget([
|
||||
'model' => $addGroupMemberForm,
|
||||
'attribute' => 'userGuids',
|
||||
'url' => Url::to(['/admin/group/new-member-search', 'id' => $group->id]),
|
||||
'placeholder' => Yii::t('AdminModule.user', 'Add new members...'),
|
||||
'focus' => true,
|
||||
])
|
||||
?>
|
||||
]) ?>
|
||||
<?= Html::activeHiddenInput($addGroupMemberForm, 'groupId', ['value' => $group->id]) ?>
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" class="btn btn-primary" style="height:40px;" data-ui-loader><i class="fa fa-plus"></i></button>
|
||||
<?= Button::primary()->submit()->style('height:40px')->icon('add') ?>
|
||||
</span>
|
||||
</div>
|
||||
<?php ActiveForm::end(); ?>
|
||||
@ -39,7 +47,7 @@ use humhub\modules\user\grid\DisplayNameColumn;
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -86,11 +94,11 @@ use humhub\modules\user\grid\DisplayNameColumn;
|
||||
return false;
|
||||
},
|
||||
'delete' => function($url, $model) use ($group) {
|
||||
return Html::a('<i class="fa fa-times"></i>', '#', [
|
||||
'data-action-click' => 'admin.group.removeMember',
|
||||
'data-action-url' => Url::to(['remove-group-user', 'id' => $group->id, 'userId' => $model->id]),
|
||||
'title' => Yii::t('AdminModule.user', 'Remove from group'),
|
||||
'class' => 'btn btn-danger btn-xs tt']);
|
||||
return Button::danger()
|
||||
->tooltip(Yii::t('AdminModule.user', 'Remove from group'))
|
||||
->action('admin.group.removeMember', Url::to(['remove-group-user', 'id' => $group->id, 'userId' => $model->id]))
|
||||
->icon('remove')->xs()
|
||||
->confirm();
|
||||
}
|
||||
],
|
||||
],
|
||||
@ -100,4 +108,4 @@ use humhub\modules\user\grid\DisplayNameColumn;
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php $this->endContent(); ?>
|
||||
<?php $this->endContent(); ?>
|
||||
|
@ -71,7 +71,7 @@ $iconUrl = SiteIcon::getUrl(140);
|
||||
|
||||
<?= Button::danger()->id('admin-delete-logo-image')
|
||||
->action('admin.deletePageLogo', Url::to(['/admin/setting/delete-logo-image']))
|
||||
->style(LogoImage::hasImage() ? '' : 'display:none')->icon('times')->sm()->loader(false) ?>
|
||||
->style(LogoImage::hasImage() ? '' : 'display:none')->icon('remove')->sm()->loader(false) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -88,7 +88,7 @@ $iconUrl = SiteIcon::getUrl(140);
|
||||
|
||||
<?= Button::danger()->id('admin-delete-icon-image')
|
||||
->action('admin.deletePageIcon', Url::to(['/admin/setting/delete-icon-image']))
|
||||
->style(SiteIcon::hasImage() ? '' : 'display:none')->icon('times')->sm()->loader(false) ?>
|
||||
->style(SiteIcon::hasImage() ? '' : 'display:none')->icon('remove')->sm()->loader(false) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use humhub\widgets\Button;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
use humhub\compat\CActiveForm;
|
||||
@ -9,7 +10,7 @@ use humhub\compat\CHtml;
|
||||
<?php $this->beginContent('@admin/views/setting/_advancedLayout.php') ?>
|
||||
|
||||
<div class="clearfix">
|
||||
<?= Html::a('<i class="fa fa-arrow-left" aria-hidden="true"></i> ' . Yii::t('AdminModule.settings', 'Back to overview'), Url::to(['setting/oembed']), ['class' => 'btn btn-default pull-right']); ?>
|
||||
<?= Button::back(Url::to(['setting/oembed']), Yii::t('AdminModule.settings', 'Back to overview')) ?>
|
||||
<h4 class="pull-left">
|
||||
<?php
|
||||
if ($prefix == "") {
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
use humhub\modules\user\grid\DisplayNameColumn;
|
||||
use humhub\modules\user\grid\ImageColumn;
|
||||
use humhub\widgets\ModalButton;
|
||||
use yii\helpers\Html;
|
||||
use yii\bootstrap\ActiveForm;
|
||||
use humhub\modules\admin\widgets\SpaceGridView;
|
||||
@ -11,11 +12,13 @@ use humhub\modules\admin\grid\SpaceImageColumn;
|
||||
use humhub\modules\admin\models\SpaceSearch;
|
||||
use yii\helpers\Url;
|
||||
|
||||
/* @var $searchModel SpaceSearch*/
|
||||
?>
|
||||
|
||||
<?= Html::a('<i class="fa fa-plus" aria-hidden="true"></i> ' . Yii::t('AdminModule.space', 'Add new space'), ['/space/create'], ['class' => 'btn btn-sm btn-success pull-right', 'data-target' => '#globalModal']); ?>
|
||||
<?= ModalButton::success(Yii::t('AdminModule.space', 'Add new space'))->load(['/space/create'])
|
||||
->icon('add')->right()->sm() ?>
|
||||
|
||||
<h4><?= Yii::t('AdminModule.space', 'Overview'); ?></h4>
|
||||
<h4><?= Yii::t('AdminModule.space', 'Overview') ?></h4>
|
||||
<div class="help-block">
|
||||
<?= Yii::t('AdminModule.space', 'This overview contains a list of each space with actions to view, edit and delete spaces.'); ?>
|
||||
</div>
|
||||
|
@ -15,10 +15,10 @@ use yii\helpers\Url;
|
||||
|
||||
|
||||
<?= Button::success(Yii::t('AdminModule.user', 'Add new field'))
|
||||
->icon('plus')->sm()->link(Url::to(['edit-field', 'categoryId' => $category->id]))->right()->style('margin-left:5px') ?>
|
||||
->icon('add')->sm()->link(Url::to(['edit-field', 'categoryId' => $category->id]))->right()->style('margin-left:5px') ?>
|
||||
|
||||
<?= Button::primary(Yii::t('AdminModule.user', 'Edit category'))
|
||||
->icon('pencil')->sm()->link(Url::to(['edit-category', 'id' => $category->id]))->right() ?>
|
||||
->icon('edit')->sm()->link(Url::to(['edit-category', 'id' => $category->id]))->right() ?>
|
||||
|
||||
|
||||
<?= GridView::widget([
|
||||
@ -81,7 +81,7 @@ use yii\helpers\Url;
|
||||
},
|
||||
'update' => function ($url, $category) {
|
||||
/* @var $model ProfileField */
|
||||
return Button::primary()->icon('pencil')->link(Url::to(['edit-field', 'id' => $category->id]))->sm();
|
||||
return Button::primary()->icon('edit')->link(Url::to(['edit-field', 'id' => $category->id]))->sm();
|
||||
},
|
||||
],
|
||||
],
|
||||
|
@ -16,7 +16,7 @@ foreach (ProfileFieldCategory::find()->orderBy('sort_order')->all() as $category
|
||||
}
|
||||
|
||||
$categoryItems[] = [
|
||||
'label' => Icon::get('plus', [
|
||||
'label' => Icon::get('add', [
|
||||
'htmlOptions' => [
|
||||
'title' => Yii::t('AdminModule.user', 'Add new category'),
|
||||
'class' => 'tt'
|
||||
|
@ -1,20 +1,28 @@
|
||||
<?php
|
||||
|
||||
use humhub\libs\Html;
|
||||
use humhub\compat\HForm;
|
||||
use humhub\widgets\Button;
|
||||
use humhub\widgets\ModalButton;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $hForm HForm */
|
||||
?>
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="clearfix">
|
||||
|
||||
<div class="pull-right">
|
||||
<?= Html::backButton(['index'], ['label' => Yii::t('AdminModule.base', 'Back to overview')]); ?>
|
||||
<?= Html::a('<i class="fa fa-paper-plane" aria-hidden="true"></i> ' . Yii::t('AdminModule.user', 'Send invite'), ['/user/invite'], ['class' => 'btn btn-success', 'data-target' => '#globalModal']); ?>
|
||||
<?= Button::back(['index'], Yii::t('AdminModule.base', 'Back to overview'))
|
||||
->right(false) ?>
|
||||
|
||||
<?= ModalButton::success(Yii::t('AdminModule.user', 'Send invite'))
|
||||
->load(['/user/invite'])->icon('invite')->sm() ?>
|
||||
</div>
|
||||
|
||||
<h4 class="pull-left"><?= Yii::t('AdminModule.user', 'Add new user'); ?></h4>
|
||||
<h4 class="pull-left"><?= Yii::t('AdminModule.user', 'Add new user') ?></h4>
|
||||
</div>
|
||||
<br>
|
||||
<?php $form = \yii\widgets\ActiveForm::begin(['options' => ['data-ui-widget' => 'ui.form.TabbedForm', 'data-ui-init' => '']]); ?>
|
||||
<?= $hForm->render($form); ?>
|
||||
<?php \yii\widgets\ActiveForm::end(); ?>
|
||||
<?php $form = ActiveForm::begin(['options' => ['data-ui-widget' => 'ui.form.TabbedForm', 'data-ui-init' => '']]); ?>
|
||||
<?= $hForm->render($form); ?>
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
|
@ -21,7 +21,7 @@ use yii\widgets\ActiveForm;
|
||||
<div class="panel-body">
|
||||
|
||||
<div class="pull-right">
|
||||
<?= Html::a('<i class="fa fa-plus" aria-hidden="true"></i> ' . Yii::t('AdminModule.user', 'Add new user'), ['/admin/user/add'], ['class' => 'btn btn-success btn-sm', 'data-ui-loader' => '']); ?>
|
||||
<?= Button::success(Yii::t('AdminModule.user', 'Add new user'))->icon('add')->sm()->link(['/admin/user/add']) ?>
|
||||
<?= ExportButton::widget(['filter' => 'UserSearch']) ?>
|
||||
</div>
|
||||
|
||||
|
@ -47,11 +47,11 @@ $module = Yii::$app->getModule('comment');
|
||||
<li>
|
||||
<a href="#" class="comment-edit-link" data-action-click="edit"
|
||||
data-action-url="<?= $editUrl ?>">
|
||||
<i class="fa fa-pencil"></i> <?= Yii::t('CommentModule.base', 'Edit') ?>
|
||||
<?= Icon::get('edit')?> <?= Yii::t('CommentModule.base', 'Edit') ?>
|
||||
</a>
|
||||
<a href="#" class="comment-cancel-edit-link" data-action-click="cancelEdit"
|
||||
data-action-url="<?= $loadUrl ?>" style="display:none;">
|
||||
<i class="fa fa-pencil"></i> <?= Yii::t('CommentModule.base', 'Cancel Edit') ?>
|
||||
<?= Icon::get('edit')?> <?= Yii::t('CommentModule.base', 'Cancel Edit') ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
@ -59,7 +59,7 @@ $module = Yii::$app->getModule('comment');
|
||||
<?php if ($canDelete): ?>
|
||||
<li>
|
||||
<a href="#" data-action-click="delete">
|
||||
<i class="fa fa-trash-o"></i> <?= Yii::t('CommentModule.base', 'Delete') ?>
|
||||
<?= Icon::get('delete') ?> <?= Yii::t('CommentModule.base', 'Delete') ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
@ -37,7 +37,7 @@ class UpdatedIcon extends Icon
|
||||
public static function getByDated($updateDate)
|
||||
{
|
||||
return static::get(static::ICON_NAME)
|
||||
->tooltip(Yii::t('ContentModule.base', 'Last updated {time}', ['time' => Yii::$app->formatter->asDatetime($updateDate, 'medium')]));
|
||||
->tooltip(Yii::t('ContentModule.base', 'Last updated {time}', ['time' => Yii::$app->formatter->asDate($updateDate, 'medium') . ' - ' . Yii::$app->formatter->asTime($updateDate, 'short')]));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -87,7 +87,11 @@ class StreamEntryOptions extends Model
|
||||
{
|
||||
parent::init();
|
||||
if(!$this->viewContext) {
|
||||
$this->viewContext = Yii::$app->request->getViewContext() ?? static::VIEW_CONTEXT_DEFAULT;
|
||||
if (Yii::$app->request->isConsoleRequest) {
|
||||
$this->viewContext = static::VIEW_CONTEXT_DEFAULT;
|
||||
} else {
|
||||
$this->viewContext = Yii::$app->request->getViewContext() ?? static::VIEW_CONTEXT_DEFAULT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,6 +192,10 @@ class StreamEntryOptions extends Model
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!ContentContainerHelper::getCurrent()->is($model->content->container)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !$this->isViewContext(static::VIEW_CONTEXT_DEFAULT);
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ if (!isset($confirmBody)) {
|
||||
->cssClass('profile-image-edit profile-image-crop') ?>
|
||||
|
||||
<?= Button::danger()
|
||||
->icon('times')
|
||||
->icon('remove')
|
||||
->action('delete', $deleteUrl)
|
||||
->style($editButtonStyle)->sm()
|
||||
->loader(false)
|
||||
|
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Url;
|
||||
use humhub\modules\ui\icon\widgets\Icon;
|
||||
|
||||
/* @var $this humhub\modules\ui\view\components\View */
|
||||
?>
|
||||
<li>
|
||||
<!-- load modal confirm widget -->
|
||||
<a href="#" data-action-click="delete">
|
||||
<i class="fa fa-trash-o"></i> <?= Yii::t('ContentModule.base', 'Delete') ?>
|
||||
<?= Icon::get('delete') ?> <?= Yii::t('ContentModule.base', 'Delete') ?>
|
||||
</a>
|
||||
</li>
|
||||
|
@ -1,25 +1,27 @@
|
||||
<?php
|
||||
|
||||
use humhub\modules\content\widgets\WallEntry;
|
||||
use humhub\modules\content\widgets\stream\WallStreamEntryWidget;
|
||||
use humhub\modules\ui\icon\widgets\Icon;
|
||||
|
||||
/* @var $this humhub\modules\ui\view\components\View */
|
||||
/* @var $mode string */
|
||||
|
||||
?>
|
||||
<li>
|
||||
<?php if($mode === WallEntry::EDIT_MODE_INLINE) : ?>
|
||||
<?php if($mode === WallStreamEntryWidget::EDIT_MODE_INLINE) : ?>
|
||||
<a href="#" class="stream-entry-edit-link" data-action-click="edit" data-action-url="<?= $editUrl ?>">
|
||||
<i class="fa fa-pencil"></i> <?= Yii::t('ContentModule.base', 'Edit') ?>
|
||||
<?= Icon::get('edit')?> <?= Yii::t('ContentModule.base', 'Edit') ?>
|
||||
</a>
|
||||
<a href="#" class="stream-entry-cancel-edit-link" data-action-click="cancelEdit" style="display:none;">
|
||||
<i class="fa fa-pencil"></i> <?= Yii::t('ContentModule.base', 'Cancel Edit') ?>
|
||||
<?= Icon::get('edit')?> <?= Yii::t('ContentModule.base', 'Cancel Edit') ?>
|
||||
</a>
|
||||
<?php elseif ($mode === WallEntry::EDIT_MODE_MODAL) : ?>
|
||||
<?php elseif ($mode === WallStreamEntryWidget::EDIT_MODE_MODAL) : ?>
|
||||
<a href="#" class="stream-entry-edit-link" data-action-click="editModal" data-action-url="<?= $editUrl ?>">
|
||||
<i class="fa fa-pencil"></i><?= Yii::t('ContentModule.base', 'Edit') ?>
|
||||
<?= Icon::get('edit')?> <?= Yii::t('ContentModule.base', 'Edit') ?>
|
||||
</a>
|
||||
<?php elseif ($mode === WallEntry::EDIT_MODE_NEW_WINDOW) : ?>
|
||||
<?php elseif ($mode === WallStreamEntryWidget::EDIT_MODE_NEW_WINDOW) : ?>
|
||||
<a href="<?= $editUrl ?>" class="stream-entry-edit-link">
|
||||
<i class="fa fa-pencil"></i><?= Yii::t('ContentModule.base', 'Edit') ?>
|
||||
<?= Icon::get('edit')?> <?= Yii::t('ContentModule.base', 'Edit') ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use humhub\modules\topic\widgets\TopicPicker;
|
||||
use humhub\modules\ui\icon\widgets\Icon;
|
||||
use yii\helpers\Html;
|
||||
use humhub\modules\content\assets\ContentFormAsset;
|
||||
use humhub\modules\file\widgets\FilePreview;
|
||||
@ -93,10 +94,11 @@ $pickerUrl = ($contentContainer instanceof Space) ? $contentContainer->createUrl
|
||||
<ul class="nav nav-pills preferences" style="right: 0; top: 5px;">
|
||||
<li class="dropdown">
|
||||
<a class="dropdown-toggle" style="padding: 5px 10px;" data-toggle="dropdown" href="#" aria-label="<?= Yii::t('base', 'Toggle post menu'); ?>" aria-haspopup="true">
|
||||
<i class="fa fa-cogs"></i></a>
|
||||
<?= Icon::get('cogs')?>
|
||||
</a>
|
||||
<ul class="dropdown-menu pull-right">
|
||||
<li>
|
||||
<?= Link::withAction(Yii::t('ContentModule.base', 'Notify members'), 'notifyUser')->icon('fa-bell')?>
|
||||
<?= Link::withAction(Yii::t('ContentModule.base', 'Notify members'), 'notifyUser')->icon('bell')?>
|
||||
</li>
|
||||
<?php if(TopicPicker::showTopicPicker($contentContainer)) : ?>
|
||||
<li>
|
||||
@ -106,7 +108,7 @@ $pickerUrl = ($contentContainer instanceof Space) ? $contentContainer->createUrl
|
||||
<?php if ($canSwitchVisibility): ?>
|
||||
<li>
|
||||
<?= Link::withAction(Yii::t('ContentModule.base', 'Make public'), 'changeVisibility')
|
||||
->id('contentForm_visibility_entry')->icon('fa-unlock') ?>
|
||||
->id('contentForm_visibility_entry')->icon('unlock') ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
|
@ -36,7 +36,7 @@ class Events
|
||||
'id' => 'dashboard',
|
||||
'label' => Yii::t('DashboardModule.base', 'Dashboard'),
|
||||
'url' => ['/dashboard/dashboard'],
|
||||
'icon' => 'tachometer',
|
||||
'icon' => 'dashboard',
|
||||
'sortOrder' => 100,
|
||||
'isActive' => MenuLink::isActiveState('dashboard')
|
||||
]));
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
namespace humhub\modules\directory;
|
||||
|
||||
use humhub\modules\ui\menu\MenuLink;
|
||||
use Yii;
|
||||
use yii\helpers\Url;
|
||||
use humhub\modules\user\models\Group;
|
||||
@ -84,14 +85,14 @@ class Module extends \humhub\components\Module
|
||||
$module = Yii::$app->getModule('directory');
|
||||
|
||||
if($module->canAccess()) {
|
||||
$event->sender->addItem([
|
||||
'label' => Yii::t('DirectoryModule.base', 'Directory'),
|
||||
$event->sender->addEntry(new MenuLink([
|
||||
'id' => 'directory',
|
||||
'icon' => '<i class="fa fa-book"></i>',
|
||||
'url' => Url::to(['/directory/directory']),
|
||||
'icon' => 'directory',
|
||||
'label' => Yii::t('DirectoryModule.base', 'Directory'),
|
||||
'url' => ['/directory/directory'],
|
||||
'sortOrder' => 400,
|
||||
'isActive' => (Yii::$app->controller->module && Yii::$app->controller->module->id == 'directory'),
|
||||
]);
|
||||
'isActive' => MenuLink::isActiveState('directory'),
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,7 +112,7 @@ class Module extends \humhub\components\Module
|
||||
|
||||
/**
|
||||
* Show groups in directory
|
||||
*
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isGroupListingEnabled()
|
||||
|
@ -1,19 +1,23 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Url;
|
||||
use yii\helpers\Html;
|
||||
use humhub\widgets\Button;
|
||||
use humhub\widgets\ModalButton;
|
||||
use humhub\widgets\PanelMenu;
|
||||
use humhub\modules\user\widgets\Image;
|
||||
|
||||
/* @var $newUsers \yii\db\ActiveQuery */
|
||||
/* @var $showInviteButton boolean */
|
||||
/* @var $showMoreButton boolean */
|
||||
?>
|
||||
<div class="panel panel-default members" id="new-people-panel">
|
||||
<?= PanelMenu::widget(['id' => 'new-people-panel']); ?>
|
||||
<?= PanelMenu::widget(['id' => 'new-people-panel']) ?>
|
||||
|
||||
<div class="panel-heading">
|
||||
<?= Yii::t('DirectoryModule.base', '<strong>New</strong> people'); ?>
|
||||
<?= Yii::t('DirectoryModule.base', '<strong>New</strong> people') ?>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<?php foreach ($newUsers->limit(10)->all() as $user) : ?>
|
||||
<?= Image::widget(['user' => $user, 'width' => 40, 'showTooltip' => true]); ?>
|
||||
<?= Image::widget(['user' => $user, 'width' => 40, 'showTooltip' => true]) ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if ($showInviteButton || $showMoreButton): ?>
|
||||
@ -21,11 +25,13 @@ use humhub\modules\user\widgets\Image;
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($showInviteButton): ?>
|
||||
<?= Html::a('<i class="fa fa-paper-plane" aria-hidden="true"></i> ' . Yii::t('DirectoryModule.base', 'Send invite'), Url::to(['/user/invite']), ['data-target' => '#globalModal']); ?>
|
||||
<?= ModalButton::primary(Yii::t('DirectoryModule.base', 'Send invite'))
|
||||
->load(['/user/invite'])->icon('invite')->sm() ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($showMoreButton): ?>
|
||||
<?= Html::a('<i class="fa fa-list-ul" aria-hidden="true"></i> ' . Yii::t('DirectoryModule.base', 'See all'), Url::to(['/directory/directory/members']), ['classx' => 'btn btn-xl btn-primary', 'class' => 'pull-right']); ?>
|
||||
<?= Button::primary(Yii::t('DirectoryModule.base', 'See all'))
|
||||
->link(['/directory/directory/members'])->icon('list-ul')->sm() ?>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -23,10 +23,10 @@ use Yii;
|
||||
use yii\db\Expression;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\VarDumper;
|
||||
use Zend\Ldap\Exception\LdapException;
|
||||
use Zend\Ldap\Ldap;
|
||||
use Laminas\Ldap\Exception\LdapException;
|
||||
use Laminas\Ldap\Ldap;
|
||||
use humhub\modules\ldap\components\ZendLdap;
|
||||
use Zend\Ldap\Node;
|
||||
use Laminas\Ldap\Node;
|
||||
|
||||
/**
|
||||
* LDAP Authentication
|
||||
@ -438,7 +438,7 @@ class LdapAuth extends BaseFormAuth implements AutoSyncUsers, SyncAttributes, Ap
|
||||
/**
|
||||
* Sets an Zend LDAP Instance
|
||||
*
|
||||
* @param \Zend\Ldap\Ldap $ldap
|
||||
* @param \Laminas\Ldap\Ldap $ldap
|
||||
*/
|
||||
public function setLdap(Ldap $ldap)
|
||||
{
|
||||
@ -519,7 +519,7 @@ class LdapAuth extends BaseFormAuth implements AutoSyncUsers, SyncAttributes, Ap
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Zend\Ldap\Exception\LdapException $ex) {
|
||||
} catch (\Laminas\Ldap\Exception\LdapException $ex) {
|
||||
Yii::error('Could not connect to LDAP instance: ' . $ex->getMessage(), 'ldap');
|
||||
} catch (\Exception $ex) {
|
||||
Yii::error('An error occurred while user sync: ' . $ex->getMessage(), 'ldap');
|
||||
|
@ -17,7 +17,7 @@ use yii\console\ExitCode;
|
||||
use yii\console\widgets\Table;
|
||||
use yii\db\Expression;
|
||||
use yii\helpers\Console;
|
||||
use Zend\Ldap\Ldap;
|
||||
use Laminas\Ldap\Ldap;
|
||||
|
||||
/**
|
||||
* Console tools for manage Ldap
|
||||
|
@ -4,13 +4,13 @@
|
||||
namespace humhub\modules\ldap\components;
|
||||
|
||||
|
||||
use Zend\Ldap\Ldap;
|
||||
use Zend\Ldap\Filter;
|
||||
use Zend\Ldap\Dn;
|
||||
use Zend\Ldap\Exception;
|
||||
use Zend\Ldap\Exception\LdapException;
|
||||
use Laminas\Ldap\Ldap;
|
||||
use Laminas\Ldap\Filter;
|
||||
use Laminas\Ldap\Dn;
|
||||
use Laminas\Ldap\Exception;
|
||||
use Laminas\Ldap\Exception\LdapException;
|
||||
use Traversable;
|
||||
use Zend\Ldap\ErrorHandler;
|
||||
use Laminas\Ldap\ErrorHandler;
|
||||
|
||||
|
||||
class ZendLdap extends Ldap
|
||||
|
@ -14,8 +14,8 @@ use humhub\modules\admin\components\Controller;
|
||||
use humhub\modules\ldap\models\LdapSettings;
|
||||
use humhub\modules\user\authclient\LdapAuth;
|
||||
use Yii;
|
||||
use Zend\Ldap\Exception\LdapException;
|
||||
use Zend\Ldap\Ldap;
|
||||
use Laminas\Ldap\Exception\LdapException;
|
||||
use Laminas\Ldap\Ldap;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,7 @@ class LdapHelper
|
||||
*/
|
||||
public static function isLdapAvailable()
|
||||
{
|
||||
if (!class_exists('Zend\Ldap\Ldap')) {
|
||||
if (!class_exists('Laminas\Ldap\Ldap')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1,22 +1,24 @@
|
||||
<?php
|
||||
|
||||
use humhub\libs\Html;
|
||||
use humhub\modules\marketplace\models\Licence;
|
||||
use yii\helpers\Url;
|
||||
use humhub\modules\ui\view\components\View;
|
||||
use humhub\widgets\Button;
|
||||
|
||||
/* @var $this \humhub\modules\ui\view\components\View */
|
||||
/* @var $this View */
|
||||
/* @var $licence Licence */
|
||||
|
||||
?>
|
||||
<div style="padding:20px" class="jumbotron">
|
||||
<div class="pull-left" style="padding-right:24px">
|
||||
<img src="<?= Yii::getAlias('@web-static/img/humhub_pro.jpg'); ?>" style="height:124px;">
|
||||
<?= Html::img(Yii::getAlias('@web-static/img/humhub_pro.jpg'), ['style' => 'height:124px']) ?>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<a href="<?= Url::to(['/marketplace/licence']); ?>" class="btn btn-primary btn-sm"><i class="fa fa-cogs"> </i>
|
||||
<?= Yii::t('MarketplaceModule.base', 'Edit licence'); ?></a>
|
||||
<?= Button::primary(Yii::t('MarketplaceModule.base', 'Edit licence'))
|
||||
->link(['/marketplace/licence'])->icon('cogs')->sm() ?>
|
||||
</div>
|
||||
<span style="font-size:36px">HumHub </span><span style="font-size:24px">Professional Edition</span><br/>
|
||||
<span style="font-size:18px"><?= Yii::t('MarketplaceModule.base', 'Version:'); ?> <?= Yii::$app->version ?></span><br/>
|
||||
<span style="font-size:18px"><?= Yii::t('MarketplaceModule.base', 'Licenced to:'); ?> <?= $licence->licencedTo; ?></span><br/>
|
||||
<span style="font-size:18px"><?= Yii::t('MarketplaceModule.base', 'Max. users:'); ?> <?= $licence->maxUsers; ?></span><br/>
|
||||
<span style="font-size:18px"><?= Yii::t('MarketplaceModule.base', 'Version:') ?> <?= Html::encode(Yii::$app->version) ?></span><br/>
|
||||
<span style="font-size:18px"><?= Yii::t('MarketplaceModule.base', 'Licenced to:') ?> <?= Html::encode($licence->licencedTo) ?></span><br/>
|
||||
<span style="font-size:18px"><?= Yii::t('MarketplaceModule.base', 'Max. users:') ?> <?= Html::encode($licence->maxUsers) ?></span><br/>
|
||||
</div>
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
namespace humhub\modules\notification\controllers;
|
||||
|
||||
use humhub\components\access\ControllerAccess;
|
||||
use humhub\components\Controller;
|
||||
use humhub\modules\notification\models\Notification;
|
||||
use Yii;
|
||||
@ -20,16 +21,13 @@ use yii\db\IntegrityException;
|
||||
*/
|
||||
class ListController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function behaviors()
|
||||
public function getAccessRules()
|
||||
{
|
||||
return [
|
||||
'acl' => [
|
||||
'class' => \humhub\components\behaviors\AccessControl::class,
|
||||
]
|
||||
[ControllerAccess::RULE_LOGGED_IN_ONLY]
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ humhub.module('post', function(module, require, $) {
|
||||
var $rtContent = $(this).children();
|
||||
var $first = $rtContent.first();
|
||||
|
||||
if($rtContent.length === 1 && $first.is('p') && $first.text().length < 150) {
|
||||
if($rtContent.length === 1 && $first.is('p') && $first.text().length < 150 && !$first.find('br').length) {
|
||||
that.$.addClass('post-short-text');
|
||||
}
|
||||
})
|
||||
@ -19,5 +19,4 @@ humhub.module('post', function(module, require, $) {
|
||||
module.export({
|
||||
Post: Post
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use humhub\widgets\Button;
|
||||
use humhub\widgets\GridView;
|
||||
use yii\bootstrap\ActiveForm;
|
||||
use humhub\modules\space\models\Space;
|
||||
@ -101,13 +102,10 @@ use yii\helpers\Html;
|
||||
return false;
|
||||
},
|
||||
'delete' => function ($url, $model) use($space) {
|
||||
$url = ['/space/manage/member/remove', 'userGuid' => $model->user->guid, 'container' => $space];
|
||||
return Html::a('<i class="fa fa-times"></i>', $url, [
|
||||
'title' => Yii::t('SpaceModule.manage', 'Remove from space'),
|
||||
'class' => 'btn btn-danger btn-xs tt',
|
||||
'data-method' => 'POST',
|
||||
'data-confirm' => 'Are you really sure?'
|
||||
]);
|
||||
return Button::danger()->tooltip(Yii::t('SpaceModule.manage', 'Remove from space'))
|
||||
->link(['/space/manage/member/remove', 'userGuid' => $model->user->guid, 'container' => $space])
|
||||
->options(['data-method' => 'POST', 'data-confirm' => Yii::t('SpaceModule.manage', 'Are you sure you want to remove this member.') ])
|
||||
->icon('remove')->xs();
|
||||
}
|
||||
],
|
||||
],
|
||||
|
@ -70,4 +70,8 @@ class Invite extends BaseNotification
|
||||
]);
|
||||
}
|
||||
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->source->createUrl('/space/space/about');
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,7 @@ use humhub\modules\user\widgets\Image;
|
||||
<div class="panel-body">
|
||||
<?php if ($space->about || $space->description): ?>
|
||||
<div>
|
||||
<div data-ui-markdown data-ui-show-more
|
||||
data-read-more-text="<?= Yii::t('SpaceModule.base', 'Read More') ?>">
|
||||
<div data-ui-markdown data-ui-show-more data-collapse-at="600">
|
||||
<?= RichText::output(empty($space->about) ? $space->description : $space->about) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -9,6 +9,7 @@
|
||||
namespace humhub\modules\space\widgets;
|
||||
|
||||
use humhub\modules\space\models\Space;
|
||||
use humhub\modules\ui\icon\widgets\Icon;
|
||||
use humhub\modules\ui\menu\DropdownDivider;
|
||||
use humhub\modules\ui\menu\MenuLink;
|
||||
use humhub\modules\ui\menu\widgets\DropdownMenu;
|
||||
@ -31,7 +32,7 @@ class HeaderControlsMenu extends DropdownMenu
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public $label = '<i class="fa fa-cog"></i>';
|
||||
public $label;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
@ -43,6 +44,11 @@ class HeaderControlsMenu extends DropdownMenu
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
if(!$this->label) {
|
||||
$this->label = Icon::get('controls');
|
||||
}
|
||||
|
||||
if ($this->template === '@humhub/widgets/views/dropdownNavigation') {
|
||||
$this->template = '@ui/menu/widgets/views/dropdown-menu.php';
|
||||
@ -107,7 +113,7 @@ class HeaderControlsMenu extends DropdownMenu
|
||||
$this->addEntry(new MenuLink([
|
||||
'label' => Yii::t('SpaceModule.manage', 'Cancel Membership'),
|
||||
'url' => $this->space->createUrl('/space/membership/revoke-membership'),
|
||||
'icon' => 'times',
|
||||
'icon' => 'remove',
|
||||
'sortOrder' => 700,
|
||||
'htmlOptions' => ['data-method' => 'POST']
|
||||
]));
|
||||
|
@ -60,7 +60,7 @@ class Menu extends LeftNavigation
|
||||
$this->addEntry(new MenuLink([
|
||||
'label' => Yii::t('SpaceModule.base', 'Stream'),
|
||||
'url' => $this->space->createUrl('/space/space/home'),
|
||||
'icon' => 'bars',
|
||||
'icon' => 'stream',
|
||||
'sortOrder' => 100,
|
||||
'isActive' => MenuLink::isActiveState('space', 'space', ['index', 'home']),
|
||||
]));
|
||||
@ -78,7 +78,7 @@ class Menu extends LeftNavigation
|
||||
$this->addEntry(new MenuLink([
|
||||
'label' => Yii::t('SpaceModule.base', 'About'),
|
||||
'url' => $this->space->createUrl('/space/space/about'),
|
||||
'icon' => 'info-circle',
|
||||
'icon' => 'about',
|
||||
'sortOrder' => 10000,
|
||||
'isActive' => MenuLink::isActiveState('space', 'space', ['about']),
|
||||
]));
|
||||
|
@ -1,112 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2016 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
namespace humhub\modules\space\widgets;
|
||||
|
||||
use humhub\modules\space\models\Space;
|
||||
use Yii;
|
||||
use yii\base\Widget;
|
||||
use yii\helpers\Url;
|
||||
|
||||
/**
|
||||
* Picker displays a space picker instead of an input field.
|
||||
*
|
||||
* To use this widget, you may insert the following code in a view:
|
||||
* <pre>
|
||||
*
|
||||
* echo humhub\modules\space\widgets\Picker::widget([
|
||||
* 'inputId' => 'space_filter',
|
||||
* 'value' => $spaceGuidsString,
|
||||
* 'maxSpaces' => 3
|
||||
* ]);
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @since 0.5
|
||||
* @deprecated since version 1.2 use SpacePickerField instead
|
||||
* @author Luke
|
||||
*/
|
||||
class Picker extends Widget
|
||||
{
|
||||
/**
|
||||
* @var string The id of input element which should replaced
|
||||
*/
|
||||
public $inputId = '';
|
||||
|
||||
/**
|
||||
* JSON Search URL - default: /space/browse/search-json
|
||||
* The token -keywordPlaceholder- will replaced by the current search query.
|
||||
*
|
||||
* @var string the search url
|
||||
*/
|
||||
public $spaceSearchUrl = '';
|
||||
|
||||
/**
|
||||
* @var int the maximum of spaces
|
||||
*/
|
||||
public $maxSpaces = 10;
|
||||
|
||||
/**
|
||||
* @var \yii\base\Model the data model associated with this widget. (Optional)
|
||||
*/
|
||||
public $model = null;
|
||||
|
||||
/**
|
||||
* The name can contain square brackets (e.g. 'name[1]') which is used to collect tabular data input.
|
||||
* @var string the attribute associated with this widget. (Optional)
|
||||
*/
|
||||
public $attribute = null;
|
||||
|
||||
/**
|
||||
* @var string the initial value of comma separated space guids
|
||||
*/
|
||||
public $value = '';
|
||||
|
||||
/**
|
||||
* @var string placeholder message, when no space is set
|
||||
*/
|
||||
public $placeholder = null;
|
||||
|
||||
/**
|
||||
* Displays / Run the Widgets
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Try to get current field value, when model & attribute attributes are specified.
|
||||
if ($this->model != null && $this->attribute != null) {
|
||||
$attribute = $this->attribute;
|
||||
$this->value = $this->model->$attribute;
|
||||
}
|
||||
|
||||
if ($this->spaceSearchUrl == '')
|
||||
$this->spaceSearchUrl = Url::to(['/space/browse/search-json', 'keyword' => '-keywordPlaceholder-']);
|
||||
|
||||
if ($this->placeholder === null) {
|
||||
$this->placeholder = Yii::t('SpaceModule.chooser', 'Add {n,plural,=1{space} other{spaces}}', ['n' => $this->maxSpaces]);
|
||||
}
|
||||
|
||||
// Currently populated spaces
|
||||
$spaces = [];
|
||||
foreach (explode(",", $this->value) as $guid) {
|
||||
$space = Space::findOne(['guid' => trim($guid)]);
|
||||
if ($space != null) {
|
||||
$spaces[] = $space;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('spacePicker', [
|
||||
'spaceSearchUrl' => $this->spaceSearchUrl,
|
||||
'maxSpaces' => $this->maxSpaces,
|
||||
'value' => $this->value,
|
||||
'spaces' => $spaces,
|
||||
'placeholder' => $this->placeholder,
|
||||
'inputId' => $this->inputId,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
@ -1,3 +1,6 @@
|
||||
<button class="btn btn-primary" data-action-click="ui.modal.load" data-action-url="<?= $space->createUrl('/space/membership/invite') ?>">
|
||||
<i class="fa fa-plus"></i> <?= Yii::t('SpaceModule.base', 'Invite') ?>
|
||||
</button>
|
||||
<?php
|
||||
use humhub\widgets\ModalButton;
|
||||
?>
|
||||
|
||||
<?= ModalButton::primary(Yii::t('SpaceModule.base', 'Invite'))
|
||||
->load($space->createUrl('/space/membership/invite'))->icon('invite') ?>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use humhub\modules\ui\icon\widgets\Icon;
|
||||
use humhub\modules\ui\view\components\View;
|
||||
use humhub\modules\directory\permissions\AccessDirectory;
|
||||
use humhub\modules\space\assets\SpaceChooserAsset;
|
||||
@ -62,16 +63,16 @@ $canAccessDirectory = $directoryModule->active && Yii::$app->user->can(AccessDir
|
||||
<form action="" class="dropdown-controls">
|
||||
<div <?php if($canAccessDirectory) : ?>class="input-group"<?php endif; ?>>
|
||||
<input type="text" id="space-menu-search" class="form-control" autocomplete="off"
|
||||
placeholder="<?= Yii::t('SpaceModule.chooser', 'Search'); ?>"
|
||||
title="<?= Yii::t('SpaceModule.chooser', 'Search for spaces'); ?>">
|
||||
placeholder="<?= Yii::t('SpaceModule.chooser', 'Search') ?>"
|
||||
title="<?= Yii::t('SpaceModule.chooser', 'Search for spaces') ?>">
|
||||
<?php if($canAccessDirectory) : ?>
|
||||
<span id="space-directory-link" class="input-group-addon" >
|
||||
<a href="<?= Url::to(['/directory/directory/spaces']); ?>">
|
||||
<i class="fa fa-book"></i>
|
||||
<a href="<?= Url::to(['/directory/directory/spaces']) ?>">
|
||||
<?= Icon::get('directory')?>
|
||||
</a>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<div class="search-reset" id="space-search-reset"><i class="fa fa-times-circle"></i></div>
|
||||
<div class="search-reset" id="space-search-reset"><?= Icon::get('times-circle') ?></div>
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
use humhub\modules\space\widgets\Image;
|
||||
use yii\helpers\Html;
|
||||
use yii\web\View;
|
||||
|
||||
$this->registerJsFile('@web-static/resources/space/spacepicker.js', ['position' => View::POS_END]);
|
||||
|
||||
// Resolve guids to space tags
|
||||
$selectedSpaces = '';
|
||||
foreach ($spaces as $space) {
|
||||
$name = Html::encode($space->name);
|
||||
$selectedSpaces .= '<li class="spaceInput" id="' . $space->guid . '">' . Image::widget(['space' => $space, 'width' => 24]) . ' ' . addslashes($name) . '<i class="fa fa-times-circle"></i></li>';
|
||||
}
|
||||
?>
|
||||
|
||||
<script <?= \humhub\libs\Html::nonce() ?>>
|
||||
$(function () {
|
||||
$('#<?= $inputId; ?>').spacepicker({
|
||||
inputId: '#<?= $inputId; ?>',
|
||||
maxSpaces: '<?= $maxSpaces; ?>',
|
||||
searchUrl: '<?= $spaceSearchUrl; ?>',
|
||||
currentValue: '<?= str_replace("\n", " \\", $selectedSpaces); ?>',
|
||||
placeholder: '<?= Html::encode($placeholder); ?>'
|
||||
});
|
||||
});
|
||||
</script>
|
@ -193,12 +193,12 @@ abstract class Stream extends Action
|
||||
|
||||
$this->streamQuery = $this->initQuery();
|
||||
|
||||
if(!$this->viewContext) {
|
||||
$this->viewContext = Yii::$app->request->get('viewContext');
|
||||
}
|
||||
|
||||
if (!Yii::$app->request->isConsoleRequest) {
|
||||
$this->streamQuery->load(Yii::$app->request->get());
|
||||
|
||||
if(!$this->viewContext) {
|
||||
$this->viewContext = Yii::$app->request->get('viewContext');
|
||||
}
|
||||
}
|
||||
|
||||
$this->beforeApplyFilters();
|
||||
|
@ -613,7 +613,7 @@ humhub.module('stream.Stream', function (module, require, $) {
|
||||
};
|
||||
|
||||
Stream.prototype.hasActiveFilters = function () {
|
||||
return this.filter && this.filter.getActiveFilterCount({exclude: ['sort', 'scope']}) > 0;
|
||||
return this.filter && this.filter.getActiveFilterCount({exclude: ['sort']}) > 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -40,8 +40,8 @@ use yii\helpers\Html;
|
||||
<div class="input-group">
|
||||
<?= Html::activeTextInput($addModel, 'name', ['style' => 'height:36px', 'class' => 'form-control', 'placeholder' => Yii::t('TopicModule.base', 'Add Topic')]) ?>
|
||||
<span class="input-group-btn">
|
||||
<?= Button::defaultType()->icon('fa-plus')->loader()->submit() ?>
|
||||
</span>
|
||||
<?= Button::defaultType()->icon('add')->loader()->submit() ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php ActiveForm::end(); ?>
|
||||
@ -59,7 +59,7 @@ use yii\helpers\Html;
|
||||
'buttons' => [
|
||||
'update' => function ($url, $model) use ($contentContainer) {
|
||||
/* @var $model \humhub\modules\topic\models\Topic */
|
||||
return ModalButton::primary()->load($contentContainer->createUrl('edit', ['id' => $model->id]))->icon('fa-pencil')->xs()->loader(false);
|
||||
return ModalButton::primary()->load($contentContainer->createUrl('edit', ['id' => $model->id]))->icon('edit')->xs()->loader(false);
|
||||
},
|
||||
'view' => function ($url, $model) use ($contentContainer) {
|
||||
/* @var $model \humhub\modules\topic\models\Topic */
|
||||
@ -67,7 +67,7 @@ use yii\helpers\Html;
|
||||
},
|
||||
'delete' => function ($url, $model) use ($contentContainer) {
|
||||
/* @var $model \humhub\modules\topic\models\Topic */
|
||||
return Button::danger()->icon('fa-times')->action('topic.removeOverviewTopic', $contentContainer->createUrl('delete', ['id' => $model->id]))->confirm(
|
||||
return Button::danger()->icon('delete')->action('topic.removeOverviewTopic', $contentContainer->createUrl('delete', ['id' => $model->id]))->confirm(
|
||||
Yii::t('TopicModule.base', '<strong>Confirm</strong> topic deletion'),
|
||||
Yii::t('TopicModule.base', 'Do you really want to delete this topic?'),
|
||||
Yii::t('base', 'Delete'))->xs()->loader(false);
|
||||
|
@ -27,7 +27,18 @@ class Module extends \humhub\components\Module
|
||||
* @var array contains all available icon aliases
|
||||
*/
|
||||
public $iconAlias = [
|
||||
'dropdownToggle' => 'angle-down'
|
||||
'dropdownToggle' => 'angle-down',
|
||||
'edit' => 'pencil',
|
||||
'delete' => 'trash',
|
||||
'dashboard' => 'tachometer',
|
||||
'directory' => 'book',
|
||||
'back' => 'arrow-left',
|
||||
'add' => 'plus',
|
||||
'invite' => 'paper-plane',
|
||||
'remove' => 'times',
|
||||
'controls' => 'cog',
|
||||
'about' => 'info-circle',
|
||||
'stream' => 'bars'
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -985,11 +985,16 @@ class Icon extends Widget
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function asString()
|
||||
{
|
||||
return (string)$this;
|
||||
try {
|
||||
return (string) $this;
|
||||
} catch (\Throwable $e) {
|
||||
Yii::error($e);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1000,7 +1005,7 @@ class Icon extends Widget
|
||||
try {
|
||||
$result = $this::widget($this->asArray());
|
||||
return $result ?: '';
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Throwable $e) {
|
||||
Yii::error($e);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ class ProfileMenu extends LeftNavigation
|
||||
if (!$module->profileDisableStream) {
|
||||
$this->addEntry(new MenuLink([
|
||||
'label' => Yii::t('UserModule.profile', 'Stream'),
|
||||
'icon' => 'bars',
|
||||
'icon' => 'stream',
|
||||
'url' => $this->user->createUrl('//user/profile/home'),
|
||||
'sortOrder' => 200,
|
||||
'isActive' => MenuLink::isActiveState('user', 'profile', ['index', 'home'])
|
||||
@ -59,7 +59,7 @@ class ProfileMenu extends LeftNavigation
|
||||
|
||||
$this->addEntry(new MenuLink([
|
||||
'label' => Yii::t('UserModule.profile', 'About'),
|
||||
'icon' => 'info-circle',
|
||||
'icon' => 'about',
|
||||
'url' => $this->user->createUrl('/user/profile/about'),
|
||||
'sortOrder' => 300,
|
||||
'isActive' => MenuLink::isActiveState('user', 'profile', 'about'),
|
||||
|
@ -61,7 +61,7 @@ class Button extends BootstrapComponent
|
||||
$text = Yii::t('base', 'Back');
|
||||
}
|
||||
|
||||
return self::defaultType($text)->link($url)->icon('fa-arrow-left')->right()->loader(true);
|
||||
return self::defaultType($text)->link($url)->icon('back')->right()->loader(true)->sm();
|
||||
}
|
||||
|
||||
public static function userPickerSelfSelect($selector, $text = null) {
|
||||
|
@ -227,8 +227,8 @@ class CoreJsConfig extends Widget
|
||||
],
|
||||
'ui.showMore' => [
|
||||
'text' => [
|
||||
'readMore' => Yii::t('PostModule.base', 'Read full post...'),
|
||||
'readLess' => Yii::t('PostModule.base', 'Collapse'),
|
||||
'readMore' => Yii::t('UiModule.base', 'Read more'),
|
||||
'readLess' => Yii::t('UiModule.base', 'Collapse'),
|
||||
]
|
||||
],
|
||||
'ui.panel' => [
|
||||
|
@ -4,9 +4,6 @@
|
||||
.dropdown-menu {
|
||||
li {
|
||||
a {
|
||||
font-size: 13px !important;
|
||||
font-weight: 600 !important;
|
||||
|
||||
i {
|
||||
margin-right: 5px;
|
||||
font-size: 14px;
|
||||
|
@ -1,174 +0,0 @@
|
||||
/**
|
||||
* Handling space chooser user input
|
||||
*/
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var chosen = []; // Array for visible space menu entries
|
||||
var arrPosition = ""; // Save the current position inside the chosen array
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Show and navigate through spaces depends on user input
|
||||
*/
|
||||
$('#space-menu-search').keyup(function (event) {
|
||||
|
||||
if (event.keyCode == 40) {
|
||||
|
||||
// set current array position
|
||||
if (arrPosition === "") {
|
||||
arrPosition = 1;
|
||||
} else if ((arrPosition) < chosen.length - 1) {
|
||||
arrPosition++;
|
||||
}
|
||||
|
||||
// remove selection from last space entry
|
||||
$('#space-menu-dropdown li ul li').removeClass('selected');
|
||||
|
||||
// add selection to the current space entry
|
||||
$('#space-menu-dropdown li ul li:eq(' + chosen[arrPosition] + ')').addClass('selected');
|
||||
|
||||
return false;
|
||||
|
||||
} else if (event.keyCode == 38) {
|
||||
|
||||
// set current array position
|
||||
if (arrPosition === "") {
|
||||
arrPosition = 1;
|
||||
} else if ((arrPosition) > 0) {
|
||||
arrPosition--;
|
||||
}
|
||||
|
||||
$('#space-menu-dropdown li ul li').removeClass('selected');
|
||||
|
||||
// add selection to the current space entry
|
||||
$('#space-menu-dropdown li ul li:eq(' + chosen[arrPosition] + ')').addClass('selected');
|
||||
|
||||
return false;
|
||||
|
||||
} else if (event.keyCode == 13) {
|
||||
|
||||
// check if one space is selected
|
||||
if ($('#space-menu-spaces li').hasClass("selected")) {
|
||||
|
||||
// move to selected space, by hitting enter
|
||||
window.location.href = $('#space-menu-dropdown li ul li.selected a').attr('href');
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// lowercase and save entered string in variable
|
||||
var input = $(this).val().toLowerCase();
|
||||
|
||||
if (input > 0) {
|
||||
// remove max-height property to hide the nicescroll scrollbar
|
||||
$('#space-menu-spaces').css({'max-height': 'none'});
|
||||
} else {
|
||||
// set max-height property to show the nicescroll scrollbar
|
||||
$('#space-menu-spaces').css({'max-height': '400px'});
|
||||
}
|
||||
|
||||
// empty variable and array
|
||||
chosen = [];
|
||||
arrPosition = "";
|
||||
|
||||
$("#space-menu-dropdown li ul li").each(function (index) {
|
||||
|
||||
// remove selected classes from all space entries
|
||||
$('#space-menu-dropdown li ul li').removeClass('selected');
|
||||
|
||||
|
||||
// lowercase and save space strings in variable
|
||||
var str = $(this).text().toLowerCase();
|
||||
|
||||
if (str.search(input) == -1) {
|
||||
// hide elements when not matched
|
||||
$(this).css('display', 'none');
|
||||
} else {
|
||||
// show elements when matched
|
||||
$(this).css('display', 'block');
|
||||
|
||||
// update array with the right li element
|
||||
chosen.push(index);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
// add selection to the first space entry
|
||||
$('#space-menu-dropdown li ul li:eq(' + chosen[0] + ')').addClass('selected');
|
||||
|
||||
// check if entered string is empty or not
|
||||
if (input.length == 0) {
|
||||
// reset inputs
|
||||
resetSpaceSearch();
|
||||
} else {
|
||||
// show search reset icon
|
||||
$('#space-search-reset').fadeIn('fast');
|
||||
}
|
||||
|
||||
// remove hightlight
|
||||
$("#space-menu-dropdown li ul li").removeHighlight();
|
||||
|
||||
// add new highlight matching strings
|
||||
$("#space-menu-dropdown li ul li").highlight(input);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//return event.returnValue;
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Disable enter key
|
||||
*/
|
||||
$('#space-menu-search').keypress(function (event) {
|
||||
if (event.keyCode == 13) {
|
||||
// deactivate the standard press event
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Click handler to reset user input
|
||||
*/
|
||||
$('#space-search-reset').click(function () {
|
||||
resetSpaceSearch();
|
||||
});
|
||||
|
||||
/**
|
||||
* Reset user input
|
||||
*/
|
||||
function resetSpaceSearch() {
|
||||
|
||||
// fade out the cross icon
|
||||
$('#space-search-reset').fadeOut('fast');
|
||||
|
||||
// empty input field
|
||||
$('#space-menu-search').val('');
|
||||
|
||||
// set focus to input field
|
||||
$('#space-menu-search').focus();
|
||||
|
||||
$("#space-menu-dropdown li ul li").each(function () {
|
||||
|
||||
// show all space entries
|
||||
$(this).css('display', 'block');
|
||||
|
||||
// remove search result highlighting
|
||||
$("#space-menu-dropdown li ul li").removeHighlight();
|
||||
|
||||
// remove the curren tspace entry selection
|
||||
$('#space-menu-dropdown li ul li').removeClass('selected');
|
||||
|
||||
});
|
||||
|
||||
// set max-height property to show the nicescroll scrollbar
|
||||
$('#space-menu-spaces').css({'max-height': '400px'});
|
||||
}
|
||||
|
||||
});
|
@ -1,352 +0,0 @@
|
||||
/*
|
||||
* SpacePicker
|
||||
* Version 1.0.0
|
||||
* Written by: Andreas Strobel
|
||||
*
|
||||
* @property String $inputId is the ID of the input HTML Element
|
||||
* @property Int $maxSpaces the maximum of users in this dropdown
|
||||
* @property String $spaceSearchUrl the url of the search, to find the spaces
|
||||
* @property String $currentValue is the current value of the parent field.
|
||||
* @property String $templates.inputStructure is the HTML structure to replace the original input element.
|
||||
*
|
||||
* License: MIT License - http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
|
||||
var chosen = "";
|
||||
var spaceCount = 0;
|
||||
|
||||
$.fn.spacepicker = function (options) {
|
||||
|
||||
// set standard options
|
||||
options = $.extend({
|
||||
inputId: "",
|
||||
maxSpaces: 0,
|
||||
searchUrl: "",
|
||||
placeholder: "",
|
||||
currentValue: "",
|
||||
}, options);
|
||||
|
||||
// add input structure template
|
||||
options = $.extend({
|
||||
templates: {
|
||||
inputStructure: '<div class="space_picker_container"><ul class="tag_input" id="space_tags"><li id="space_tag_input"><input type="text" id="space_input_field" class="tag_input_field" value="" autocomplete="off" placeholder="'+options.placeholder+'"></li></ul><ul class="dropdown-menu" id="spacepicker" role="menu" aria-labelledby="dropdownMenu"></ul></div>'
|
||||
}
|
||||
}, options);
|
||||
|
||||
|
||||
init();
|
||||
|
||||
|
||||
function init() {
|
||||
|
||||
// remove picker if existing
|
||||
$('.space_picker_container').remove();
|
||||
|
||||
// insert the new input structure after the original input element
|
||||
$(options.inputId).after(options.templates.inputStructure);
|
||||
|
||||
// hide original input element
|
||||
$(options.inputId).hide();
|
||||
|
||||
if (options.currentValue != "") {
|
||||
|
||||
// restore data from database
|
||||
restoreSpaceTags(options.currentValue);
|
||||
}
|
||||
|
||||
// simulate focus in
|
||||
$('#space_input_field').focusin(function () {
|
||||
$('#space_tags').addClass('focus');
|
||||
})
|
||||
|
||||
// simulate focus out
|
||||
$('#space_input_field').focusout(function () {
|
||||
$('#space_tags').removeClass('focus');
|
||||
});
|
||||
|
||||
$('body').append($('#spacepicker'));
|
||||
}
|
||||
|
||||
function restoreSpaceTags(html) {
|
||||
|
||||
// add html structure for input element
|
||||
$('#space_tags').prepend(html);
|
||||
|
||||
// create function for every space tag to remove the element
|
||||
$('#space_tags .spaceInput i').each(function () {
|
||||
|
||||
$(this).click(function () {
|
||||
|
||||
// remove user tag
|
||||
$(this).parent().remove();
|
||||
|
||||
// reduce the count of added spaces
|
||||
spaceCount--;
|
||||
|
||||
})
|
||||
|
||||
// raise the count of added spaces
|
||||
spaceCount++;
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Set focus on the input field, by clicking the <ul> construct
|
||||
jQuery('#space_tags').click(function () {
|
||||
|
||||
// set focus
|
||||
$('#space_input_field').focus();
|
||||
})
|
||||
|
||||
$('#space_input_field').keydown(function (event) {
|
||||
|
||||
// by pressing the tab key an the input is empty
|
||||
if ($(this).val() == "" && event.keyCode == 9) {
|
||||
|
||||
//do nothing
|
||||
|
||||
// by pressing enter, tab, up or down arrow
|
||||
} else if (event.keyCode == 40 || event.keyCode == 38 || event.keyCode == 13 || event.keyCode == 9) {
|
||||
|
||||
// ... disable the default behavior to hold the cursor at the end of the string
|
||||
event.preventDefault();
|
||||
|
||||
}
|
||||
|
||||
// if there is a space limit and the user didn't press the tab key
|
||||
if (options.maxSpaces != 0 && event.keyCode != 9) {
|
||||
|
||||
// if the max space count is reached
|
||||
if (spaceCount == options.maxSpaces) {
|
||||
|
||||
// show hint
|
||||
showHintSpaces();
|
||||
|
||||
// block input events
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$('#space_input_field').keyup(function (event) {
|
||||
|
||||
// start search after a specific count of characters
|
||||
if ($('#space_input_field').val().length >= 3) {
|
||||
|
||||
// set spacepicker position in bottom of the space input
|
||||
$('#spacepicker').css({
|
||||
position: "absolute",
|
||||
top: $('#space_input_field').offset().top + 30,
|
||||
left: $('#space_input_field').offset().left + 2
|
||||
})
|
||||
|
||||
if (event.keyCode == 40) {
|
||||
|
||||
// select next <li> element
|
||||
if (chosen === "") {
|
||||
chosen = 1;
|
||||
} else if ((chosen + 1) < $('#spacepicker li').length) {
|
||||
chosen++;
|
||||
}
|
||||
$('#spacepicker li').removeClass('selected');
|
||||
$('#spacepicker li:eq(' + chosen + ')').addClass('selected');
|
||||
return false;
|
||||
|
||||
} else if (event.keyCode == 38) {
|
||||
|
||||
// select previous <li> element
|
||||
if (chosen === "") {
|
||||
chosen = 1;
|
||||
} else if (chosen > 0) {
|
||||
chosen--;
|
||||
}
|
||||
$('#spacepicker li').removeClass('selected');
|
||||
$('#spacepicker li:eq(' + chosen + ')').addClass('selected');
|
||||
return false;
|
||||
|
||||
} else if (event.keyCode == 13 || event.keyCode == 9) {
|
||||
|
||||
var href = $('#spacepicker .selected a').attr('href');
|
||||
// simulate click event when href is not undefined.
|
||||
if (href !== undefined) {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// save the search string to variable
|
||||
var str = $('#space_input_field').val();
|
||||
|
||||
// show spacepicker with the results
|
||||
$('#spacepicker').show();
|
||||
|
||||
// load spaces
|
||||
loadSpaces(str);
|
||||
}
|
||||
} else {
|
||||
|
||||
// hide spacepicker
|
||||
$('#spacepicker').hide();
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('#space_input_field').focusout(function () {
|
||||
|
||||
// set the plain text including user guids to the original input or textarea element
|
||||
$(options.inputId).val(parseSpaceInput());
|
||||
})
|
||||
|
||||
|
||||
function loadSpaces(string) {
|
||||
|
||||
// remove existings entries
|
||||
$('#spacepicker li').remove();
|
||||
|
||||
// show loader while loading
|
||||
$('#spacepicker').html('<li><div class="loader"><div class="sk-spinner sk-spinner-three-bounce"><div class="sk-bounce1"></div><div class="sk-bounce2"></div><div class="sk-bounce3"></div></div></div></li>');
|
||||
|
||||
jQuery.getJSON(options.searchUrl.replace('-keywordPlaceholder-', string), function (json) {
|
||||
|
||||
// remove existings entries
|
||||
$('#spacepicker li').remove();
|
||||
|
||||
|
||||
if (json.length > 0) {
|
||||
|
||||
|
||||
for (var i = 0; i < json.length; i++) {
|
||||
|
||||
var _guid = json[i].guid;
|
||||
var _title = addslashes(htmlDecode(json[i].title));
|
||||
var _image = $('<div/>').text(json[i].image).html();
|
||||
_image = _image.replace(/"/g, '\\\'');
|
||||
|
||||
// build <li> entry
|
||||
var str = '<li><a tabindex="-1" href="javascript:addSpaceTag(\'' + _guid + '\', \'' + _image + '\', \'' + _title + '\');">' + json[i].image + ' ' + _title + '</a></li>';
|
||||
|
||||
// append the entry to the <ul> list
|
||||
$('#spacepicker').append(str);
|
||||
|
||||
}
|
||||
|
||||
// reset the variable for arrows keys
|
||||
chosen = "";
|
||||
|
||||
} else {
|
||||
|
||||
// hide spacepicker, if no space was found
|
||||
$('#spacepicker').hide();
|
||||
}
|
||||
|
||||
|
||||
// remove hightlight
|
||||
$("#spacepicker li").removeHighlight();
|
||||
|
||||
// add new highlight matching strings
|
||||
$("#spacepicker li").highlight(string);
|
||||
|
||||
// add selection to the first space entry
|
||||
$('#spacepicker li:eq(0)').addClass('selected');
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
function showHintSpaces() {
|
||||
|
||||
// remove hint, if exists
|
||||
$('#maxSpaceHint').remove();
|
||||
|
||||
// build html structure
|
||||
var _html = '<div id="maxSpaceHint" style="display: none;" class="alert alert-danger"><button type="button" class="close" data-dismiss="alert">×</button><strong>Sorry!</strong> You can add a maximum of ' + options.maxSpaces + ' default spaces for this group.</div>';
|
||||
|
||||
// add hint to DOM
|
||||
$('#space_tags').after(_html);
|
||||
|
||||
// fadein hint
|
||||
$('#maxSpaceHint').fadeIn('fast');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Add a space tag for invitation
|
||||
function addSpaceTag(guid, image, name) {
|
||||
|
||||
// Building a new <li> entry
|
||||
var _tagcode = '<li class="spaceInput" id="' + guid + '">' + image + ' ' + name + '<i class="fa fa-times-circle"></i></li>';
|
||||
|
||||
|
||||
// insert the new created <li> entry into the <ul> contruct
|
||||
$('#space_tag_input').before(_tagcode);
|
||||
|
||||
|
||||
// remove tag, by clicking the close icon
|
||||
$('#' + guid + " i").click(function () {
|
||||
|
||||
// remove space tag
|
||||
$('#' + guid).remove();
|
||||
|
||||
// reduce the count of added spaces
|
||||
spaceCount--;
|
||||
|
||||
})
|
||||
|
||||
// hide space results
|
||||
$('#spacepicker').hide();
|
||||
|
||||
// set focus to the input element
|
||||
$('#space_input_field').focus();
|
||||
|
||||
// Clear the textinput
|
||||
$('#space_input_field').val('');
|
||||
|
||||
// raise the count of added spaces
|
||||
spaceCount++;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function parseSpaceInput() {
|
||||
|
||||
// create and insert a dummy <div> element to work with
|
||||
$('#space_tags').after('<div id="spaceInputResult"></div>')
|
||||
|
||||
// set html form input element to the new <div> element
|
||||
$('#spaceInputResult').html($('#space_tags').html());
|
||||
|
||||
|
||||
$('#spaceInputResult .spaceInput').each(function () {
|
||||
|
||||
// add the space guid as plain text
|
||||
$(this).after(this.id + ",");
|
||||
|
||||
// remove the link
|
||||
$(this).remove();
|
||||
})
|
||||
|
||||
// save the plain text
|
||||
var result = $('#spaceInputResult').text();
|
||||
|
||||
// remove the dummy <div> element
|
||||
$('#spaceInputResult').remove();
|
||||
|
||||
// return the plain text
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
function addslashes(str) {
|
||||
|
||||
return (str + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0');
|
||||
}
|
||||
|
||||
function htmlDecode(value) {
|
||||
return $("<textarea/>").html(value).text();
|
||||
}
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user