Enh: Added Pending Registrations admin view with csv, xlsx support. + small cleanups

This commit is contained in:
buddh4 2017-08-01 22:14:06 +02:00
parent 03fdb7a5df
commit 3f741da0a2
6 changed files with 57 additions and 46 deletions

View File

@ -1,6 +1,7 @@
<?php
use humhub\libs\Html;
use yii\bootstrap\ActiveForm;
humhub\assets\TabbedFormAsset::register($this);
?>
@ -12,7 +13,7 @@ humhub\assets\TabbedFormAsset::register($this);
</div>
</div>
<div class="panel-body">
<?php $form = \yii\bootstrap\ActiveForm::begin(['options' => ['data-ui-widget' => 'ui.form.TabbedForm', 'data-ui-init' => '']]); ?>
<?php $form = ActiveForm::begin(['options' => ['data-ui-widget' => 'ui.form.TabbedForm', 'data-ui-init' => '', 'style' => 'display:none']]); ?>
<?= $hForm->render($form); ?>
<?php \yii\bootstrap\ActiveForm::end(); ?>
<?php ActiveForm::end(); ?>
</div>

View File

@ -8,6 +8,8 @@
namespace humhub\modules\admin\widgets;
use humhub\modules\admin\models\UserApprovalSearch;
use humhub\modules\user\models\Invite;
use Yii;
use yii\helpers\Url;
@ -45,7 +47,21 @@ class UserMenu extends \humhub\widgets\BaseMenu
])
]);
$approvalCount = \humhub\modules\admin\models\UserApprovalSearch::getUserApprovalCount();
$inviteCount = Invite::find()->count();
if ($inviteCount > 0) {
$this->addItem([
'label' => Yii::t('AdminModule.user', 'Pending registrations') . ' <span class="label label-danger">' . $inviteCount . '</span>',
'url' => Url::to(['/admin/pending-registrations']),
'sortOrder' => 300,
'isActive' => (Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'pending-registrations'),
'isVisible' => Yii::$app->user->can([
new \humhub\modules\admin\permissions\ManageUsers(),
new \humhub\modules\admin\permissions\ManageGroups()
])
]);
}
$approvalCount = UserApprovalSearch::getUserApprovalCount();
if ($approvalCount > 0) {
$this->addItem([
'label' => Yii::t('AdminModule.user', 'Pending approvals') . ' <span class="label label-danger">' . $approvalCount . '</span>',

View File

@ -88,7 +88,7 @@ class Comment extends ContentAddonActiveRecord implements ContentOwner
try {
$this->updateContentSearch();
} catch (\yii\base\Exception $ex) {
;
Yii::error($ex);
}
parent::afterDelete();

View File

@ -49,7 +49,7 @@ class CreateController extends Controller
/**
* Creates a new Space
*/
public function actionCreate($visibility = null)
public function actionCreate($visibility = null, $skip = 0)
{
// User cannot create spaces (public or private)
if (!Yii::$app->user->permissionmanager->can(new CreatePublicSpace) && !Yii::$app->user->permissionmanager->can(new CreatePrivateSpace)) {
@ -59,6 +59,9 @@ class CreateController extends Controller
$model = $this->createSpaceModel();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
if($skip) {
return $this->htmlRedirect($model->getUrl());
}
return $this->actionModules($model->id);
}

View File

@ -13,12 +13,12 @@
/* @var $isNew boolean */
/* @var $isNew boolean */
/* @var $originator \humhub\modules\user\models\User */
/* @var source yii\db\ActiveRecord */
/* @var contentContainer \humhub\modules\content\components\ContentContainerActiveRecord */
/* @var space humhub\modules\space\models\Space */
/* @var record \humhub\modules\notification\models\Notification */
/* @var html string */
/* @var text string */
/* @var $source yii\db\ActiveRecord */
/* @var $contentContainer \humhub\modules\content\components\ContentContainerActiveRecord */
/* @var $space humhub\modules\space\models\Space */
/* @var $record \humhub\modules\notification\models\Notification */
/* @var $html string */
/* @var $text string */
?>
<?php $this->beginContent('@notification/views/layouts/mail.php', $_params_); ?>

View File

@ -1,53 +1,44 @@
<?php
use humhub\widgets\ActiveForm;
use humhub\widgets\ModalButton;
use humhub\widgets\ModalDialog;
use yii\helpers\Url;
$animation = $model->hasErrors() ? 'shake' : 'fadeIn';
?>
<div class="modal-dialog modal-dialog-small animated <?= $animation ?>">
<div class="modal-content">
<?php $form = ActiveForm::begin(); ?>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title"
id="myModalLabel"><?php echo Yii::t('SpaceModule.views_create_create', '<strong>Create</strong> new space'); ?></h4>
</div>
<div class="modal-body">
<?php ModalDialog::begin(['header' => Yii::t('SpaceModule.views_create_create', '<strong>Create</strong> new space'), 'size' => 'small']) ?>
<?php $form = ActiveForm::begin(); ?>
<div class="modal-body">
<?= humhub\modules\space\widgets\SpaceNameColorInput::widget(['form' => $form, 'model' => $model])?>
<?= humhub\modules\space\widgets\SpaceNameColorInput::widget(['form' => $form, 'model' => $model]) ?>
<?php echo $form->field($model, 'description')->textarea(['placeholder' => Yii::t('SpaceModule.views_create_create', 'space description'), 'rows' => '3']); ?>
<?php echo $form->field($model, 'description')->textarea(['placeholder' => Yii::t('SpaceModule.views_create_create', 'space description'), 'rows' => '3']); ?>
<a data-toggle="collapse" id="access-settings-link" href="#collapse-access-settings"
style="font-size: 11px;"><i
class="fa fa-caret-right"></i> <?php echo Yii::t('SpaceModule.views_create_create', 'Advanced access settings'); ?>
</a>
<a data-toggle="collapse" id="access-settings-link" href="#collapse-access-settings" style="font-size: 11px;">
<i class="fa fa-caret-right"></i> <?php echo Yii::t('SpaceModule.views_create_create', 'Advanced access settings'); ?>
</a>
<div id="collapse-access-settings" class="panel-collapse collapse">
<br/>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'join_policy')->radioList($joinPolicyOptions); ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'visibility')->radioList($visibilityOptions); ?>
</div>
<div id="collapse-access-settings" class="panel-collapse collapse">
<br/>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'join_policy')->radioList($joinPolicyOptions); ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'visibility')->radioList($visibilityOptions); ?>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-primary"
data-action-click="ui.modal.submit"
data-ui-loader
data-action-url="<?= Url::to(['/space/create/create']) ?>">
<?= Yii::t('SpaceModule.views_create_create', 'Next'); ?>
</a>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
<div class="modal-footer">
<?= ModalButton::submitModal(Url::to(['/space/create/create']), Yii::t('SpaceModule.views_create_create', 'Next')) ?>
<?= ModalButton::submitModal(Url::to(['/space/create/create', 'skip' => 1]), Yii::t('SpaceModule.views_create_create', 'Skip'))
->setType('info')->icon('fa-forward', true)->cssClass('tt')->options(['title' => Yii::t('SpaceModule.views_create_create', 'Skip other steps')]) ?>
</div>
<?php ActiveForm::end(); ?>
<?php ModalDialog::end(); ?>
<script type="text/javascript">
$('#collapse-access-settings').on('show.bs.collapse', function () {